Post

Replies

Boosts

Views

Activity

What is the purpose of getSnapshot method from WidgetKit?
I'm trying to figure out what exactly should I do in getSnapshot method. However, it is not easy. In Apple's documentation, there is a very general description and in their demo app its implementation is also very simple. There is one obvious use-case when we need to return TimelineEntry for widget gallery preview when context.isPreview = true. However, what should be done when context.isPreview = false? Should I return there the last entry prepared in getTimeline method? Should I verify if the configuration has changed between calls of getTimeline and getSnapshot? My widget is using data from API. Should I call it in getSnapshot or only in getTimeline? If I don't have cached entry, what should I return then? Placeholder entry? Why they need getSnapshot if they could just take the entry from Timeline? Currently, I'm returning here either preview entry or the last cached entry during getTimeline also checking if it matches the new configuration. However, I'm not sure if this is the correct approach.
3
0
4.1k
Oct ’20
How positioning in App Store works in terms of localization?
How does providing localized descriptions for iOS application affect its positioning in search results? Of course, it will increase visibility for localized keywords, but let's assume that a German Apple Id is looking for an English keyword. Will the application be higher in results if it provides German localization (even if the search phrase is in English and does not occur in German localization)? In general, what is taken into account when presenting search results in the App Store? (only content for the user's current region assigned to Apple ID?). If I have "some position" in search results in X region and I will remove localization for Y region will it have any impact on my position in X?
0
0
672
Oct ’20
[Xcode 12.1] Circle().trim not drawing after Xcode update
My custom controls stopped working after updating Xcode to 12.1 from 12. It works in application project, but it doesn't work in Widget Extension. Sample view that stopped working: struct WidgetsEntryView : View { 		var body: some View { 				Circle() 						.trim(from: 0, to: 0.75) 		} } If you remove trim it renders correctly. With trim nothing appears. It worked before.
5
0
1.4k
Oct ’20
Why is it not possible to provide a free trial for paid apps?
My application uses "paid" monetization model. I think in the productivity category it works quite well. However, when I advertise my application, 50% of the questions are: "is there a free trial?" and I would love to provide a free trial to potential customers, but the App Store doesn't allow me to do that. I don't understand why this feature is not available. I even started considering migration to in-app purchases, but it's quite a big deal. I managed to establish quite a good profit and I'm worried how it would affect my positioning and results. On top of that, I really like the paid up-front model, because it solves many issues and doesn't need any extra implementation on my side. I'm starting this thread to hear what you think about that and how many people are looking for this feature. I also created a feature request in Feedback Assistant: #FB13810170
1
0
565
May ’24
Incorrect macOS app icon size
I created my macOS app icon using the resources provided on the website for macOS Sonoma (Production Templates): https://developer.apple.com/design/resources/ However, when I check my app icon on the App Store, it has an incorrect size. Although, it is presented correctly in the Dock. Any ideas on how to fix that? Should I export the icon without padding that is by default set for the export? I used the Sketch template. I also reported it using Feedback Assistant: #FB13811586
3
0
572
May ’24
Predicitive Text is presenting suggestions in incorrect language when 3rd party keyboard is installed
I'm the developer of a third-party keyboard app, Snippety - Snippets Manager, which is designed for using snippets rather than regular typing. One of my users has encountered a strange issue: after installing my keyboard (even when it is not actively in use), the predictive text bar starts showing suggestions in Polish. This happens despite the Polish language not being installed on the device. The issue resolves as soon as my keyboard is uninstalled from the system settings. Interestingly, my application (including the keyboard) does not support the Polish language, nor is Polish specified anywhere in the app. The app was developed and published from macOS in English. This seems to be an iOS bug. The only language-related configuration in my keyboard is the PrimaryLanguage key in the Info.plist file, which I set to "mul" because the keyboard is not intended for typing. I also tried setting it to "mis", but the issue persists. The video presenting this issue on an iPhone 15 simulator running iOS 17.5: https://www.dropbox.com/scl/fi/xjdyucxpmv1cv0mnmwzvd/prdictive-text-issue.mp4?rlkey=aphznpdti08pz8xl84ojbyxz3&dl=0 Info.plist for my keyboard: My project settings: Steps to reproduce: Configure iOS to use English language only, with English keyboard Enable predictive text feature in the system Install Snippety keyboard Use the regular keyboard & start typing "dzie" Actual result: Polish predictions appear even though the Polish language is not installed or declared by the keyboard. Expected result: The predictive text should present predictions based on system settings. What is even more weird, I discovered that when I add the keyboard in system settings, it automatically installs Polish language in the system settings. I even changed PrimaryLanguage to "de" (German) in Info.plist but it still installs Polish. See: https://www.dropbox.com/scl/fi/aiv5g4z331zwy827zj47v/incorrect-language-installed.mp4?rlkey=16v5gqmb6mj8yuyyd7jwmjnsw&dl=0 Any ideas what could be wrong? I also created a ticket: #FB13949087 I also found a similar issue from 2018 (O_O) reported here: https://stackoverflow.com/questions/53069262/ios-adds-new-preferred-language-when-installing-my-3rd-party-keyboard
3
0
645
Jun ’24
I can't update macOS Sequoia Beta installed on SSD to the latest release
I installed macOS Sequoia Beta 1 on external SSD and I boot it on my MacBook Pro. I changed my startup disk in Settings to point SSD and I install update via "Software Update". The file is downloaded then my computer restarts and it takes around ~20 seconds to install everything, but once the macOS is started, I see that I've got still Beta 1. I tried also to download the full installer and repeat the process but with the same result. It looks like everything is installed correctly, but once the system is launched, it's still the old macOS version. Any idea how to update the system on my SSD?
0
2
893
Jul ’24
How to ensure fast synchronization between devices using iCloud Database?
For a long time, I've been using just a shared file via iCloud to ensure synchronization between devices. It works very well, everything is synchronized within seconds. However, I started encountering issues with race conditions, especially if there are more than 2 devices updating data. It's easy then to override the database accidentally. That's why I decided to try with the tool that is designed for that: iCloud Database. However, I quickly realized that the performance was extremely low. As I understand, the recommended approach to listen to changes in the database is to create a subscription, and I did that. However, during my tests, I discovered that it can take even 10 or more minutes to get that notification. It's unacceptable, some user could be waiting for new changes on their device. I could of course spam with fetch every 10 seconds (using changeToken), but I'm not sure if it's a good idea. I could also provide manual fetch like pull to refresh or something like that, but automatic synchronization would be much better for the user.
2
0
401
Jul ’24
CloudKit is not accessible from iOS extension targets
Hi! I'm using CoreData + CloudKit. It works well both on macOS and iOS, however, I can't make it work with extensions (share, action, keyboard). I get Invalid bundle ID for container error: <CKSchedulerActivity: 0x3029f4d20; identifier=com.apple.coredata.cloudkit.activity.export.A65D5B7A-18AA-400A-B25F-F042E46646F6, priority=2, container=iCloud.com.org.app.dev:Sandbox, relatedApplications=( "com.org.App.dev.App-Keyboard" ), xpcActivityCriteriaOverrides={ ActivityGroupName = "com.apple.coredata.cloudkit.App Keyboard.A65D5B7A-18AA-400A-B25F-F042E46646F6"; Delay = 0; Priority = Utility; }> error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _recoverFromPartialError:forStore:inMonitor:](2812): <NSCloudKitMirroringDelegate: 0x303fd82d0>: Error recovery failed because the following fatal errors were found: { "<CKRecordZoneID: 0x300ef9bc0; zoneName=com.apple.coredata.cloudkit.zone, ownerName=__defaultOwner__>" = "<CKError 0x300efa5e0: \"Permission Failure\" (10/2007); server message = \"Invalid bundle ID for container\"; op = xxxxxxx; uuid = zzzzz-xxxxx; container ID = \"iCloud.com.org.app.dev\">"; } I checked everything 10x: profiles, bundle ids, entitlements, etc. I even removed all local provisioning profiles and recreated them, I also tried setting different CloudKit container, but nothing helps. I tested it on a real device. My setup: main app bundle id: com.org.App.dev keyboard bundle id: com.org.App.dev.App-Keyboard action extension bundle id: com.org.App.dev.Action-Extension CloudKit container id: iCloud.com.org.app.dev I keep the CoreData database in the app group container, but I also tried locally and it doesn't really matter. This is how I setup my CoreData: self.persistentContainer = NSPersistentCloudKitContainer(name: "AppCoreModel") persistentContainer.persistentStoreDescriptions = [createCloudStoreDescription()] persistentContainer.loadPersistentStores { [self] _, error in if let error { logError("Could not load Core Data store \(error)") } else { persistentContainer.viewContext.automaticallyMergesChangesFromParent = true persistentContainer.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy logDebug(persistentContainer.persistentStoreDescriptions.first?.url?.absoluteString ?? "") logDebug("Core Data store loaded") } } private func createCloudStoreDescription() -> NSPersistentStoreDescription { let cloudStoreOptions = NSPersistentCloudKitContainerOptions( containerIdentifier: "iCloud.com.org.app.dev" ) cloudStoreOptions.databaseScope = .private let documentsUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: AppConstants.appGroupId)! let cloudStoreDescription = NSPersistentStoreDescription( url: documentsUrl.appendingPathComponent("cloud-database.sqlite") ) cloudStoreDescription.type = NSSQLiteStoreType cloudStoreDescription.cloudKitContainerOptions = cloudStoreOptions cloudStoreDescription.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) cloudStoreDescription.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey) return cloudStoreDescription } Any help would be highly appreciated. It seems like iOS bug, because everything seems to be configured properly. I even checked app identifiers if containers are properly assigned. Similar issue when using CloudKit directly (unresolved): https://developer.apple.com/forums/thread/665280
3
0
491
Jul ’24
CoreData + CloudKit synchronization is very unstable & unreliable
CloudKit sync is very unstable. Sometimes it just stops syncing for no reason, other times it works almost instantly. The core issue with synchronization is that CoreData relies mostly on two things: silent push notifications, which are by design unreliable and can be throttled user interactions, I noticed that the local database is updated most likely periodically and also based on some app events like entering the foreground. Unfortunately, there is no SDK function that allows us to force sync with CloudKit, which basically prevents us from providing some features to recover if a user encounters problems. After thousands of tests, I finally discovered what was wrong and how to make the synchronization stable. Basically, I noticed that at some point CoreData decides that it won't synchronize data unless you deactivate and activate the application, which is crazy. It's getting even worse if we talk about extensions like the keyboard extension on iOS. The same happens on all platforms. Therefore, knowing that I implemented a trick that happened to work perfectly. The workaround requires to periodically sending an event pretending that the app is going foreground. macOS: var cancellable = Set<AnyCancellable>() // ... Timer.publish(every: 20.0, on: RunLoop.main, in: .common) .autoconnect() .sink { _ in NotificationCenter.default.post(.init(name: NSApplication.willBecomeActiveNotification)) } .store(in: &cancellable) iOS: var cancellable = Set<AnyCancellable>() // ... Timer.publish(every: 20.0, on: RunLoop.main, in: .common) .autoconnect() .sink { _ in NotificationCenter.default.post(.init(name: UIApplication.didBecomeActiveNotification)) } .store(in: &cancellable) After that, everything works perfectly. Pitty that the solution mostly meant for enterprise is so unstable and there is not even a single SDK function to recover from that (force sync). Any plans to fix CoreData+CloudKit? I also created a ticket: #FB14531806.
2
0
638
Jul ’24
Prevent wiping out all records when user disables iCloud sync for the app
Hello, I'm using NSPersistentCloudKitContainer. If the user disables iCloud sync for my app in the system settings and opens the app, all records are immediately wiped out, even if there are unsynced changes (like records added offline). Disabling iCloud sync doesn't even show any warning, so the user may lose all data (if it's not already synced to Cloud). Is it possible to intercept that the store will be wiped out when the app is launching? I would copy all records to the local storage then to avoid losing data by the user.
1
0
379
Aug ’24
The recommended way of handling CoreData+CloudKit errors
What is the recommended way of intercepting and processing errors? As far as I know, there are 4 main areas: iCloud account status - this can be checked and intercepted via notifications exceptions from fetch/execute/save - it can be a simple do..catch, but what exceptions can we expect here, what should be handled, and how? there could be some asynchronous issues with synchronization. How should we intercept them and how should they be handled? issues with iCloud storage - quota exceeded, etc. How to intercept & handle those? I'm trying to achieve production-ready implementation, but there are many pitfalls and hidden issues that are not well documented. Could you provide some advice on how to handle properly all these situations?
3
0
397
Aug ’24