Post

Replies

Boosts

Views

Activity

Unable to set applicationUsername on SKPayment
I am following "What's New in StoreKit" from WWDC17 to set up payment for subscriptions in my app and the author of the talk recommends to set applicationUsername to an opaque user ID. When I tried to set it, it turned out it is readonly. (iOS 15) Is this still a recommended practice, to set that property on SKPayment? Thanks
1
0
1.1k
Sep ’21
Are Introductory Offer Dates Inclusive?
Let's say I want to create an introductory offer starting from the 1st of November till the end of the year. (it should begin at 01-11-2021 00:00:00 and expire at 31-12-2021 23:59:59) Which of the options below is correct in that case? Option 1 Start date: 1 November End Date: 31 December Option 2 Start date: 1 November End Date: 1st of January
1
0
1.2k
Nov ’21
KeyChain returns nil for a value that is set
I store the information whether the user has premium subscription in the KeyChain. I just have a global function called doesUserHavePremium that reads a value from the KeyChain. It appears that sometimes that value is read from the KeyChain incorrectly—even though I am 100% sure it is set, it returns nil. This happens only when the app was launched, then left for some time (probably screen got locked), and then I reentered the app again without relaunching it from scratch. I tried the following things: loosening the KeyChain access the the least restrictive the following piece of code to notify UI elements whenfalse/trueis read for that value after previously not being able to access it let protectedDataAvailabilityNotificationName = UIApplication.protectedDataDidBecomeAvailableNotification func observeProtectedDataAvailability() {   let selector = #selector(Self.protectedDataAvailableNotification)   switch UIApplication.shared.isProtectedDataAvailable {   case true: break   case false:     NotificationCenter.default.addObserver(self,                         selector: selector,                         name: protectedDataAvailabilityNotificationName,                         object: nil)   } } @objc func protectedDataAvailableNotification(notification: NSNotification) {   NotificationCenter.default.removeObserver(self, name: protectedDataAvailabilityNotificationName, object: nil)   dataDidBecomeAvailable() } func dataDidBecomeAvailable() {   refreshSubscriptionStatusSubscribers() } But it doesn't seem to work. The problem is that I cannot debug it, because the app has to enter background in order for this problem to manifest itself. I have read several threads related to this issue here and on GitHub and it seems like there isn't any great solution. I am looking for some workarounds. Any hints are welcome. I will try the following now: Try to store that value in UserDefaults instead—it is not really a secret like a password/token, but I need to be sure it cannot be tampered with. Not sure if UserDefaults suffer from the same problem. Try to refactor to code to wrap the doesUserHavePremium and cache its return value in a property. That seems promising, because it never happens during fresh start thus I could always set that property on the app startup.
0
1
1.6k
Oct ’21
Custom fonts & support for many languages
My language learning app needs to support a lot of languages and text paragraphs containing 2 different languages are not uncommon. (e.g. German grammar explained in Arabic) Now, I want to integrate a custom font to make the design unique and consistent across multiple platforms (iOS, Android, Web), but there is basically no single Font that supports all languages. The question is: What is the recommended way of implementing that on the code level in SwiftUI? If I just hardcode: .font(Font.custom("myFont", size: 16)) then I guess it is not gonna work if the text contains a language not supported by my custom font. The Apple's default font seems to handle all languages perfectly, even if they are mixed together and I'd like to have something like that, but with a custom font. Specifically, I'd like to integrate FF Din font: https://www.myfonts.com/fonts/fontfont/ff-din/ with supported Languages: Western Europe, Vietnamese, Central/Eastern Europe, Baltic, Turkish, Romanian, Cyrillic, Greek So I am wondering what I would do about Chinese, Arabic, etc. Thanks
0
1
1.4k
Feb ’22
Offer Codes cannot be redeemed
I have been using the Offer Codes that can be generated in App Store Connect (up to 25k per quarter). They had worked before, but at some point of time they just stopped working. My production device (iPhone 13 Pro) doesn't even render the redemption screen properly and says the code expired, even if it didn't. (already submitted a bug report, sadly without answer till this day: https://feedbackassistant.apple.com/feedback/12261784) Apart from that, I asked some friends to try to redeem a test offer code for me and surprisingly, the native redemption screen is rendered properly, but the code cannot be redeemed. (Clicking "Redeem" doesn't show the payment sheet) Any idea what the cause can be and how to fix it? To me it looks like it is a problem with StoreKit API, because I followed the documentation on how to use the native iOS offer code redemption sheet and I don't even receive an app store notification. Looks like there is a problem between the device and Apple's API.
5
1
2.1k
Dec ’23
Sing in with Apple logo alignment
My app offers login via Apple and Facebook and I would like the logos of both buttons to be aligned. By default apple's logo is centrally aligned on the leading side of the text and facebook's logo is aligned to the leading edge. It makes it look as follows: [__________X_Continue with Apple___________] [_Y__________Continue with Facebook________] (where X is the apple logo, Y is the Facebook logo and _ is whitespace). The closest hint I found on how to do that is this: Inset the logo if necessary. If you need to horizontally align the Apple logo with other authentication logos, you can adjust the space between the logo and the button’s leading edge. (source: https://developer.apple.com/design/human-interface-guidelines/sign-in-with-apple/overview/buttons/#:~:text=If%20you%20need%20to%20horizontally,8%25%20of%20the%20button's%20width.) But how do I do that? I use SwiftUI and I wrap the login with Apple button with a UIViewRepresentable. The ASAuthorizationAppleIDButton class doesn't offer logo alignment property (only ButtonType and ButtonStyle). Any advice on how to do it would be appreciated.
0
1
1.1k
Mar ’21
Automatically add device frames to screenshots
I need to add frames to auto-generated screenshots for multiple devices and multiple languages so that I can display these on my app's landing page. I guess it must be quite a standard task so my question is: Is there anything that can be reused to get this job done? All screenshot file names contain: language device name generation I would prefer not to have to manually add frames to 10 screenshots * number_of_devices * number_of_languages. Right now I actually only need iPhone Pro (not Max) and iPad Pro 12.9 (newest gen), but in the future I might need it for other devices too.
4
0
8.4k
Mar ’23