Post

Replies

Boosts

Views

Created

Provisional Notifications - no device token
I have been following the official Apple documentation on how to set up notifications in my app: https://developer.apple.com/documentation/usernotifications/asking_permission_to_use_notifications I noticed there is this option .provisional, which doesn't ask the user for authorization, but instead it is granted right away and then notifications are delivered quietly to the notification center's history. So far so good, but once I am granted authorization for sending .provisional notifications, the callback with the DeviceToken does not fire. I have this method in my AppDelegate:    func application(     _ application: UIApplication,     didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data   ) {     let tokenParts = deviceToken.map { data in String(format: "%02.2hhx", data) }     let token = tokenParts.joined()     ManagementService.sharedInstance().storeDeviceToken(token: token)   } And it fires when authorization for normal notifications is granted, but it doesn't for the provisional notifications. So the question is—how can I deliver the provisional notifications if I don't have the device token? My plan was to do the following: ask for authorization to send provisional notifications on first app launch and send the device token to my server ask for authorization to send normal notifications some time later (let's say after a week or after completing some action in the app) EDIT: Found the problem—I was calling the same method to register for remote notification after being granted authorization for both provisional and normal notifications:    func getNotificationSettings() {    UNUserNotificationCenter.current().getNotificationSettings { settings in      guard settings.authorizationStatus == .authorized else { return }             DispatchQueue.main.async {       UIApplication.shared.registerForRemoteNotifications()      }           }   } In this case settings.authorizationStatus == .authorized is false for provisional notifications (even though they are always authorized...). So I just omitted checking of settings.authorizationStatus for provisional notifications and the device token is there.
2
0
1.5k
Jan ’22
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
Introductory offer - Trial + Reduced Price
Hi, I would like to create an introductory offer that includes a 1-week trial period and a reduced price for the initial period. But it seems that with the Introductory offers it is either or. Apple's documentation says that I should be using "Introductory offers to attract new customers" so I don't want to use Promotional offers for that. Also, I'd like to have the benefit of Introductory offers, which allows them to be claimed only once and not be available after that anymore. Any advice how I can implement this? Thanks
1
0
2.7k
Apr ’22
Where can I get used Offer Codes from?
I would like to programmatically keep track of offer codes that have been used. I just configured a Test Offer Code (Reference name), which contains 500 codes (Offer Codes) to buy a 1-month subscription for 0,49€. I was able to redeem the code and everything works, but I was expecting to receive the used code. Instead I received the Reference name in the payload from the App Store Server Notification in the field offer_code_ref_name="Test Offer Code". (expected was sth like offer_code_ref_name="JFFDS61SBJDBJ5BXJS4BX") I would be able to identify the Reference name by the code, if it was provided, because I have the following table in my app's backend: reference_name | code | url | expires_at | used | reserved Test Offer Code | xadz | zzz | 31-07-2022 | t | f Test Offer Code | asdf | xxx | 31-07-2022 | f | f The used code doesn't seem to be included in the latest receipt. How can I obtain it? Can I somehow call App Store Connect API? Thanks
5
0
2.7k
Jul ’22
Apple Email Relay
Hi, I am receiving some bug reports from the users of my app and I would like to either thank you or ask for details via email. The use the "hide my email" option, which makes it harder for me to just directly write them an email. I have configured SendGrid to support Apple Email Relay when sending emails programmatically, but I'd like to have a quick and easy way to just write a single email or two sometimes. What would be the easiest way to be able to send an email from Gmail to someone using Apple Email Relay? Thank you!
0
0
1k
Dec ’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
Sep ’23
Present Offer Code Price Programmatically
Hi, I have a 12 months subscription which I generated some offer codes for. I generated 25000 of them manually in App Store Connect (One-Time Use Codes). I want to send those codes to users by push notifications and I need to show the final price when the code will be applied. The problem is that I use the native sheet, which only shows the price after the user entered the code. Is there an API that I can hook into to retrieve that price? Otherwise, the best I could do would be to calculate ActualPrice * Discount (because I know the discount since I created the codes), but I am afraid it will not be accurate enough, because it is not possible to select price for offer codes with that precision.
0
0
713
Apr ’24