Post

Replies

Boosts

Views

Created

Switching language sometimes makes the app freeze
I followed the advice from one of the latest WWDC videos on how to handle localization and in my app I launch Settings of my app when the user wants to change the app language (not system language). The user can then select one of the available languages that my app is localized for. The localization part works well, but sometimes it happens that when I click the < My app button in the leading, top corner or just navigate back to my app, I encounter a frozen screen and then the app just quits and restarts after 2-3 seconds. I don't need to preserve any state when the user changes the language, but I would certainly like to prevent this freeze from happening. The desired behaviour would be that the app restarts once the use changes the app language. I use SwiftUI as the UI framework. I use the following code to open the Settings of my app for the user: UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!) How can I achieve that?
1
0
1.6k
Sep ’21
AVSpeechSynthesizer - how to run callback onError
I use AVSpeechSynthesizer to pronounce some text in German. Sometimes it works just fine and sometimes it doesn't for some unknown to me reason (there is no error, because the speak() method doesn't throw and the only thing I am able to observe is the following message logged in the console): _BeginSpeaking: couldn't begin playback I tried to find some API in the AVSpeechSynthesizerDelegate to register a callback when error occurs, but I have found none. The closest match was this (but it appears to be only available for macOS, not iOS): https://developer.apple.com/documentation/appkit/nsspeechsynthesizerdelegate/1448407-speechsynthesizer?changes=_10 Below you can find how I initialize and use the speech synthesizer in my app: class Speaker: NSObject, AVSpeechSynthesizerDelegate {   class func sharedInstance() -> Speaker {     struct Singleton {       static var sharedInstance = Speaker()     }     return Singleton.sharedInstance   }       let audioSession = AVAudioSession.sharedInstance()   let synth = AVSpeechSynthesizer()       override init() {     super.init()     synth.delegate = self   }       func initializeAudioSession() {     do {       try audioSession.setCategory(.playback, mode: .spokenAudio, options: .duckOthers)       try audioSession.setActive(true, options: .notifyOthersOnDeactivation)     } catch {             }   }       func speak(text: String, language: String = "de-DE") { guard !self.synth.isSpeaking else { return }     let utterance = AVSpeechUtterance(string: text)     let voice = AVSpeechSynthesisVoice.speechVoices().filter { $0.language == language }.first!           utterance.voice = voice     self.synth.speak(utterance)   } } The audio session initialization is ran during app started just once. Afterwards, speech is synthesized by running the following code: Speaker.sharedInstance.speak(text: "Lederhosen") The problem is that I have no way of knowing if the speech synthesis succeeded—the UI is showing "speaking" state, but nothing is actually being spoken.
0
0
1k
Aug ’21
Limit available app languages
I have my app localized for many languages, but I'd like to limit the available app languages to only a subset of those, because the content is not ready for all of them. I don't want to delete localization files, because they contain some useful translations that I will use in the future. The only thing I was able to find and try out is this piece of code: class AppDelegate: NSObject, UIApplicationDelegate {   func application(     _ application: UIApplication,     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?   ) -> Bool {           UserDefaults.standard.set(["Base", "pl", "de", "ru"], forKey: "AppleLanguages")     UserDefaults.standard.synchronize()           ApplicationDelegate.shared.application(       application,       didFinishLaunchingWithOptions: launchOptions     )     return true   } } but unfortunately it does not work. When I launch Settings of my app, I can still choose from about 20-30 languages that I have already some translations for.
4
0
1.9k
Aug ’21
Do I need separate SKProduct for subscription with and without trial?
Hi, I am setting up auto-renewable subscriptions for my app. I have set up 4 subscriptions for 1,3,6, and 12 months with a one week free trial. Works like a charm, everything is displayed properly on device, etc. But now I need to take into account multiple cases and one of them is when the user has already consumed the free trial, cancelled the subscription, and then is about to subscribe again. I don't want to present "1 Week Free Trial" on the payment screen and certainly I don't want the user, who has already used the trial, to be eligible to use it again. So the question is if I need 2 sets of subscriptions in total? With Trial: my_app_1_month_trial my_app_3_months_trial my_app_6_months_trial my_app_12_months_trial And without trial: my_app_1_month my_app_3_months my_app_6_months my_app_12_months And then when user has already used the free trial (this piece of information will be either fetched from my server or an apple receipt), I add use the SKProducts from the "without trial" set and the user is charged immediately.
1
0
852
Aug ’21
SplitView navigation broken on iPad
I have two tabs in my app that contain a view with a list of items. When user taps an item, the navigation to detail view is triggered. On iPhone the list view takes the whole screen and it works just fine. However, on iPad those views are rendered in SplitView with the list of items on the left and the detail view on the right and the navigation works only for the first tap. After that, tapping any item doesn't change the detail view at all. I can see the following message in the console: Unable to present. Please file a bug. One of the views has an option to switch between SplitView and StackedView and the navigation works just fine in the StackedView on iPad. So clearly there is a problem with navigation in the SplitView. I just updated my iPad OS to 14.7 and still doesn't work, but it worked just fine on iPad OS 13 and 14... 40% of my app on iPad has become useless, because user simply cannot navigate to the simplest detail view :/ Has anyone else encountered this?
0
0
554
Jul ’21
Showing the correct price based on user's location
Hi, I am preparing to launch an app that will use subscription model. I am a solo developer and I have recently discovered the price tiers, which sound great to me, because I will be able to pick one price tier and have Apple adjust the price and currency for different regions. My problem is, once I pick a price tier, how do I know which price and currency to display in the app. It would be ideal if I could set up the pricing in App Store Connect and then use a built-in API to fetch the pricing in the app and it would magically already display the price and currency matching the user's region. Any hints?
0
0
563
Apr ’21
Switching language sometimes makes the app freeze
I followed the advice from one of the latest WWDC videos on how to handle localization and in my app I launch Settings of my app when the user wants to change the app language (not system language). The user can then select one of the available languages that my app is localized for. The localization part works well, but sometimes it happens that when I click the < My app button in the leading, top corner or just navigate back to my app, I encounter a frozen screen and then the app just quits and restarts after 2-3 seconds. I don't need to preserve any state when the user changes the language, but I would certainly like to prevent this freeze from happening. The desired behaviour would be that the app restarts once the use changes the app language. I use SwiftUI as the UI framework. I use the following code to open the Settings of my app for the user: UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!) How can I achieve that?
Replies
1
Boosts
0
Views
1.6k
Activity
Sep ’21
AVSpeechSynthesizer - how to run callback onError
I use AVSpeechSynthesizer to pronounce some text in German. Sometimes it works just fine and sometimes it doesn't for some unknown to me reason (there is no error, because the speak() method doesn't throw and the only thing I am able to observe is the following message logged in the console): _BeginSpeaking: couldn't begin playback I tried to find some API in the AVSpeechSynthesizerDelegate to register a callback when error occurs, but I have found none. The closest match was this (but it appears to be only available for macOS, not iOS): https://developer.apple.com/documentation/appkit/nsspeechsynthesizerdelegate/1448407-speechsynthesizer?changes=_10 Below you can find how I initialize and use the speech synthesizer in my app: class Speaker: NSObject, AVSpeechSynthesizerDelegate {   class func sharedInstance() -> Speaker {     struct Singleton {       static var sharedInstance = Speaker()     }     return Singleton.sharedInstance   }       let audioSession = AVAudioSession.sharedInstance()   let synth = AVSpeechSynthesizer()       override init() {     super.init()     synth.delegate = self   }       func initializeAudioSession() {     do {       try audioSession.setCategory(.playback, mode: .spokenAudio, options: .duckOthers)       try audioSession.setActive(true, options: .notifyOthersOnDeactivation)     } catch {             }   }       func speak(text: String, language: String = "de-DE") { guard !self.synth.isSpeaking else { return }     let utterance = AVSpeechUtterance(string: text)     let voice = AVSpeechSynthesisVoice.speechVoices().filter { $0.language == language }.first!           utterance.voice = voice     self.synth.speak(utterance)   } } The audio session initialization is ran during app started just once. Afterwards, speech is synthesized by running the following code: Speaker.sharedInstance.speak(text: "Lederhosen") The problem is that I have no way of knowing if the speech synthesis succeeded—the UI is showing "speaking" state, but nothing is actually being spoken.
Replies
0
Boosts
0
Views
1k
Activity
Aug ’21
Limit available app languages
I have my app localized for many languages, but I'd like to limit the available app languages to only a subset of those, because the content is not ready for all of them. I don't want to delete localization files, because they contain some useful translations that I will use in the future. The only thing I was able to find and try out is this piece of code: class AppDelegate: NSObject, UIApplicationDelegate {   func application(     _ application: UIApplication,     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?   ) -> Bool {           UserDefaults.standard.set(["Base", "pl", "de", "ru"], forKey: "AppleLanguages")     UserDefaults.standard.synchronize()           ApplicationDelegate.shared.application(       application,       didFinishLaunchingWithOptions: launchOptions     )     return true   } } but unfortunately it does not work. When I launch Settings of my app, I can still choose from about 20-30 languages that I have already some translations for.
Replies
4
Boosts
0
Views
1.9k
Activity
Aug ’21
Do I need separate SKProduct for subscription with and without trial?
Hi, I am setting up auto-renewable subscriptions for my app. I have set up 4 subscriptions for 1,3,6, and 12 months with a one week free trial. Works like a charm, everything is displayed properly on device, etc. But now I need to take into account multiple cases and one of them is when the user has already consumed the free trial, cancelled the subscription, and then is about to subscribe again. I don't want to present "1 Week Free Trial" on the payment screen and certainly I don't want the user, who has already used the trial, to be eligible to use it again. So the question is if I need 2 sets of subscriptions in total? With Trial: my_app_1_month_trial my_app_3_months_trial my_app_6_months_trial my_app_12_months_trial And without trial: my_app_1_month my_app_3_months my_app_6_months my_app_12_months And then when user has already used the free trial (this piece of information will be either fetched from my server or an apple receipt), I add use the SKProducts from the "without trial" set and the user is charged immediately.
Replies
1
Boosts
0
Views
852
Activity
Aug ’21
SplitView navigation broken on iPad
I have two tabs in my app that contain a view with a list of items. When user taps an item, the navigation to detail view is triggered. On iPhone the list view takes the whole screen and it works just fine. However, on iPad those views are rendered in SplitView with the list of items on the left and the detail view on the right and the navigation works only for the first tap. After that, tapping any item doesn't change the detail view at all. I can see the following message in the console: Unable to present. Please file a bug. One of the views has an option to switch between SplitView and StackedView and the navigation works just fine in the StackedView on iPad. So clearly there is a problem with navigation in the SplitView. I just updated my iPad OS to 14.7 and still doesn't work, but it worked just fine on iPad OS 13 and 14... 40% of my app on iPad has become useless, because user simply cannot navigate to the simplest detail view :/ Has anyone else encountered this?
Replies
0
Boosts
0
Views
554
Activity
Jul ’21
Showing the correct price based on user's location
Hi, I am preparing to launch an app that will use subscription model. I am a solo developer and I have recently discovered the price tiers, which sound great to me, because I will be able to pick one price tier and have Apple adjust the price and currency for different regions. My problem is, once I pick a price tier, how do I know which price and currency to display in the app. It would be ideal if I could set up the pricing in App Store Connect and then use a built-in API to fetch the pricing in the app and it would magically already display the price and currency matching the user's region. Any hints?
Replies
0
Boosts
0
Views
563
Activity
Apr ’21