Post not yet marked as solved
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
Post not yet marked as solved
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
Post not yet marked as solved
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.
Post not yet marked as solved
After running automated UI tests it turned out that my app looks quite different on iPad simulator than on real iPad.
I have my iPad Pro 12,9" right next to me and the app looks completely fine, but on Simulator (same device model on Simulator) the geometry is simply wrong.
I use SwiftUI's GeometryReader to properly place elements, add horizontal padding if the screen width is wide and in landscape orientation.
It is not the worst case, because on real device everything looks fine, but I wanted to use screenshots generated by these tests and the ones taken on iPad Simulators are simply useless. iPhone Simulator is totally fine.
Am I doing something wrong? Has anybody encountered this?
I run the tests in the following way:
projectName="./MyProject.xcodeproj"
schemeName="MyProject"
simulators=(
...
"iPhone 12 Pro Max"
...
"iPad Pro (12.9-inch) (5th generation)"
...
)
languages=(
"en"
...
)
appearances=(
"light"
"dark"
)
xcrun simctl boot "$simulator"
xcrun simctl ui "$simulator" appearance $appearance
xcodebuild -testLanguage $language -scheme $schemeName -project $projectName -derivedDataPath '/tmp/MyProjectDerivedData/' -destination "platform=iOS
Post not yet marked as solved
Hi,
I have launched an app built with SwiftUI for iOS 14+.
It turned out that SwiftUI for iOS 15+ introduced some quite important changes for my app (most of all better support for NavigationLinks and managing keyboard with FocusState).
From now on, I'd like to only release updates for iOS 15+, but I don't want to lose any users and any ratings/reviews on the App Store.
Could someone please let me know what the exact outcomes of setting the deployment target to a newer iOS are?
Is it that the users with iOS older than iOS 15, will simply not see/receive updates? Will all the ratings and reviews be intact?
Thank you
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
Post not yet marked as solved
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.
Post not yet marked as solved
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.
Post not yet marked as solved
I have been following these resources to set up auto-renewable subscriptions in my app written in SwiftUI:
What's new in StoreKit (WWDC17)
Advanced StoreKit (WWDC17)
https://blckbirds.com/post/how-to-use-in-app-purchases-in-swiftui-apps/
I basically have a class that implements SKProductsRequestDelegate instantiated in SubscribeView that processes the transactions. I was able to complete the entire flow in Sandbox (got the receipt and the server notification, created a corresponding subscription entry in my database).
The response coming from the verifyReceipt endpoint is quite complex and I am not sure if I understand it correctly. I am looking for an easy solution to get the latest subscription state. I don't want to focus on churn rate or anything else now.
Questions:
Does on-device receipt get automatically modified when the user cancels or modifies the subscriptions or when the trial period ends? If yes, can I rely on resubmitting the latest receipt from the device to my backend in order to keep track of the latest subscription state? I could resubmit the latest receipt on app startup, the server would verify and possibly update the subscription.
In the Advanced StoreKit (WWDC17) talk, it is mentioned to implement SKProductsRequestDelegate as soon as possible (e.g. in the AppDelegate). Do I even need that if I already have that delegate implemented in the SubscribeView? If I understood correctly, the purpose of that would be to be notified of the transactions done after some time (subscription change, cancellation, entering grace period, etc.). I'd prefer to ignore these for now and just rely on resubmitting the latest receipt to check the current subscription.
Post not yet marked as solved
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
Post not yet marked as solved
I am slowly distributing my app to Beta testers via TestFlight. A few of them have already reported that the app showed “No Internet connection” while on WiFi. As soon as they switched to cellular everything started to work. But the WiFi worked for them for everything else.
One of the testers installed the app today for the first time. Still no Internet connection after switching back to WiFi from cellular.
I use Alamofire as a framework to make HTTPRequests and when these requests fail, “No Internet connection” error is displayed.
My backend service is hosted on Google Cloud, my domain is registered using AWS Route 53. I use SSL certificates managed by Google.
All HTTPRequests are sent to https://api.myapp.com (where myapp.com is hosted on AWS).
All of the testers have Automatic DNS resolution set in Settings -> WiFi -> (i) -> DNS
So far it occurred on iPhone XR and iPhone 12.
iOS versions 14.X
Any ideas how I can further investigate this issue?
Thanks
Post not yet marked as solved
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?
Post not yet marked as solved
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.
Post not yet marked as solved
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.
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.