Hi,
I have the following odd scenario: Sometimes(tm) after using my app the interface feezes, often just while scrolling but other times while performing a tap gesture.
When this happens I can see in the debugger that the app is still active and things are happening in the background. Also, when move the app to the background and then open it again, the screen that should have opened is visible and fully functional. Example: I tap an element in a List, then freeze. Background/foreground switch. I now can see the correct detail view that is fully functional. Using another element to eg. go back to the List, freeze again at the old view, and same thing.
I can also not see the freeze when Instrumenting. I can see the app working continuous and even core animation commits happening.
I thought is is because I have not migrated to the NavigationPath pattern but I now have done this for most of the app (at least removing all deprecation warnings) but it still happens.
Any idea what might be a reasons for such a behavior? Thanks!
Post
Replies
Boosts
Views
Activity
Hi,
I have implemented iCloud Sync using NSPersistentCloudKitContainer. However, I have a lot of data to sync in my use case which can take quite some time (minutes) especially when starting with a new device (10's of minutes).
I was wondering if there is a way to make good use of BGProcessingTaskRequest (ie long running task over night, potentially with requiresExternalPower). The idea is to let the device catch up with the remote store during such a long running background task over night/during charge.
I already tried to hack my way into this by trying to just listen to sync events during the task and not finish the task until sync events have stopped but it seems the sync processor does have its own awareness of the app moving to the background and therefore might not even wake up during the background task.
Any idea how I can help the CloudKitContainer to catch up in the background with very large workloads?
Thanks!
Hi, I currently have an app that has the following business model:
Upfront: Free
In-App: You can either subscribe monthly or pay a one-time-fee to unlock everything. Both via IAP.
I would like to move to a one-time-fee upfront via the normal App Store payment.
I am wondering what the best (and simplest way of doing so is). Please comment!
Options I see:
Make the app "paid"; remove all IAP from within the app.
Pros:
Easiest to implement.
Cons:
All people who downloaded the app for free before can now re-download for free and I don't see a dime.
What to do with existing subscribers? Can I "developer-cancel" their subscriptions somehow, so that they don't continue to pay? Alternatively, I could ask them do that themselves on App launch.
Make app "paid" but keep IAP for people who have downloaded for free.
This would require to to somehow get the "paid price" from the app receipt. Not sure if this is possible. Alternatively, I could check for the period of the first download (if possible).
Pros:
I don't lose money from the "I downloaded free before"-people.
Cons:
I need to maintain two payment systems + it will be potentially confusing because some people can IAP, others can't.
Move to a new app SKU for the paid-upfront version.
Pros:
New app would be clean.
Cons:
I'd like the people who unlocked the "one-time-unlock" IAP to download that new SKU for free. Is that possible? Probably not. So I'd charge them twice which I would like to avoid. Alternatively, I could somehow validate their IAP in app and ask them to contact me with some proof to provide them a free promo code for the new SKU. Not sure if this is allowed per App Store rules.
Any other ideas?
Hi,
I recently added iCloud sync capability to my app via NSPersistentCloudKitContainer. It does push data to the cloud, in other words seems to be working fine. However, I noticed a strong increase in battery drain and when I debug (release and debug build configs) I can see that a NSManagedObjectContext thread that is definitely not mine has 100% CPU load basically all the time. (I waited a few minutes, yes minutes, for it to finish while not using the app at all and it does not stop.)
Component utilization shows that most the energy impact is CPU and "overhead" is very low (goes to 0 quickly). There is no network activity visible, so this seems to be some kind of background processing. Also, memory is very, very low (~ 35 MB).
I am wondering if I am doing something wrong here or if there is a better practice. Some info about how my app works:
It downloads things from the web and generates a lot of entities while doing so.
It frequently saves changes (incremental changes in entities, there are lots of save() calls during a refresh).
I have not had PersistantHistory enabled before changing my processes to work with iCloud (existing sqlite store).
Not sure if anything else is relevant. Any help is appreciated.
A bit of log:
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _scheduleAutomatedExportWithLabel:activity:completionHandler:](2958): <NSCloudKitMirroringDelegate: 0x281d34680> - Beginning automated export - ExportActivity:
<CKSchedulerActivity: 0x2805bf2f0; containerID=<CKContainerID: 0x282950510; containerIdentifier=iCloud.app.***, containerEnvironment="Sandbox">, identifier=com.apple.coredata.cloudkit.activity.export.368A54A8-5EA2-4177-B6DD-5404550042AD, priority=2, xpcActivityCriteriaOverrides={ Priority=Utility }>
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate executeMirroringRequest:error:](884): <NSCloudKitMirroringDelegate: 0x281d34680>: Asked to execute request: <NSCloudKitMirroringExportRequest: 0x28337ed40> 3052F013-BA85-4BB8-8935-74F829AACA4B
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _scheduleAutomatedImportWithLabel:activity:completionHandler:](2922): <NSCloudKitMirroringDelegate: 0x281d34680> - Beginning automated import - ImportActivity - in response to activity:
<CKSchedulerActivity: 0x28057a3f0; containerID=<CKContainerID: 0x282900300; containerIdentifier=iCloud.app.***, containerEnvironment="Sandbox">, identifier=com.apple.coredata.cloudkit.activity.import.368A54A8-5EA2-4177-B6DD-5404550042AD, priority=2, xpcActivityCriteriaOverrides={ Priority=Utility }>
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate executeMirroringRequest:error:](884): <NSCloudKitMirroringDelegate: 0x281d34680>: Asked to execute request: <NSCloudKitMirroringImportRequest: 0x2833664c0> 98E2628F-6AE5-43C0-BA9E-2B72707B31DC
Profile of what that thread is doing (inverted):
Hi,
I am trying to enable syncing a local Core Data store via CloudKit so that user generated content will be synced across their devices ("private database").
I was watching the matching WWDC session and reading a few tutorials. However, nowhere does anyone mention that the CloudKit schema needs to be managed manually or explicitly while the Apple docs do (see here).
I am now at the point where I setup everything (but the manual schema stuff) but nothing is happening on two devices logged in into the same iCloud account. I also don't see any iCloud related logs although I set -com.apple.CoreData.CloudKitDebug 4 as a launch argument.
I'd rather not manage the cloud schema manually if it is possible to maintain it lazily but I am also not sure what I am doing wrong. Any hints will be appreciated. Thanks!
Since iOS 15.1, I am seeing the log message
CADisplayTimingsControl too many requests.
My app is SwiftUI based and yes, I do have one location in the code that uses CADisplayLink but I am fairly sure it is not the culprit.
I am seeing this during scrolling/list reloads in a SwiftUI app with a List/ForEach construct. At the same time I have multiple WKWebViews loading remote websites. I am not sure what the problem is but the app does lock up often with a deadlock in the main thread while none of my code is executed.
Any help with where this might be coming from is appreciated. I suspect it is a regression related to Pro Motion and/or SwiftUI an filed a radar including crash report as FB9731877.
My app does validate the receipt on launch. When I do this via Xcode on app launch, I am presented with a Sign In prompt, because the Xcode version does understandably not include a receipt.
However, on TestFlight, the app also does not include a receipt or at least I am seeing the same prompt which should be the result of refreshing the receipt on launch if none is available.
I am wondering if this will also happen for apps downloaded from the App Store? I think it would be bad UX to have the first thing happen in the app be asked to sign in with you Apple ID. Or is this related to the app using the "sandbox" environment via TestFlight?
Any hints will be appreciated. Thanks!
I am currently testing the IAP flow as described here in the dev sandbox.
https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/testing_in-app_purchases_with_sandbox/testing_an_interrupted_purchase
In short, user needs to first agree to terms and conditions before a purchase can be made. The flow works until point 10.
User requests to buy something, transaction starts in purchasing state, then it fails, I call finishTransaction on the failed on and update the UI accordingly. The system popup triggers "You need to agree to the T&Cs.", the user agrees to it, then a system message says "Your purchase is ready" and returns to my app.
However, in point 10, it would expect a new transaction in my queue but I am not getting one. If I move the app to the background and foreground again, the queue receives one but not immediately after the purchase which is pretty bad user experience because the UI just says that the transaction failed (which is true).
Am I doing something wrong here? As I said, I am getting the valid transaction but the queue triggers only on app "relaunch". :(
I have a widget that opens my app via a custom url scheme (myapp:some-deep-link). In my app I have a handler setup like so:
var body: some Scene {
WindowGroup {
ContentView()
.onOpenURL(perform: { url in
//my code
}
}
}
In iOS 14 this works perfectly, in iOS 15 (Simulator & iPhone 13 Pro) onOpenURL is not called at all. The app launches, but there is no call.
Any ideas? (Filed as FB9657924)
I created a horizontally scrolling view modifier that essentially wraps the contents and applies a horizontal offset based on a DragGesture GestureState.
It looks a little bit like this
@GestureState private var dragOffset: CGFloat = 0
content
.offset(x: dragOffset, y: 0)
.simultaneousGesture(DragGesture(minimumDistance: 20, coordinateSpace: .global)
.updating($dragOffset) { (value, gestureState, transaction) in
gestureState = value.translation.width
})
The problem I am seeing is that on the Pro Motion Display of the iPhone 13 Pro, the "offset" view does not smoothly slide along with your finger as it drags. Instead is is very jaggy or laggy, probably rendered with maybe 15 fps or so. On the iPhone 11 Pro I used before, the drag is very smooth and on the iOS 15 simulator it is smooth as well.
What is wrong here? Thanks for help!
I have an app that is requesting a BGProcessingTaskRequest -- this is the type of background activity that is encouraged to use if you have a process that is long running and advertised to even be able to retrain a machine learning model.
My background processing generally uses a DispatchQueue.global(qos: .background)) but I can't completely control this as I also for instance use a private Core Data background context.
However, my process gets killed due to cpu usage.
Event: cpu usage
Action taken: Process killed
CPU: 48 seconds cpu time over 55 seconds (87% cpu average), exceeding limit of 80% cpu over 60 seconds
CPU limit: 48s
Limit duration: 60s
CPU used: 48s
CPU duration: 55s
Duration: 55.24s
Duration Sampled: 40.95s
Steps: 22
Why is iOS imposing a CPU limit when the process is advertised as "A request to launch your app in the background to execute a processing task that can take minutes to complete.". The device was also plugged in during the crash.
The high cpu usage obviously is on purpose and also happens in a low-level Accelerate framework operation that I could not even throttle if I wanted to.
Any idea what I am doing wrong?
I am wondering how well the "custom model" approach works for larger collections of documents. Assuming I have a corpus with a 100'000 sentences, would the custom model approach still be the way to go to look up the nearest neighbor for a query?
Are there other mechanisms provided by the system for efficient vector similarity lookup?
Is there a rule of thumb for the (key-)size for the custom model until it will have acceptable performance?
I really like the new sentenceEmbedding API and would like to use it in a project. However, how would you deal with situations in which there is specific vocabulary that the model most likely had not seen in its training corpus.
For instance, an app that allows you to answer rule questions for board games with vocabulary specific to the game (eg. fanatasy/sci-fi/...).
Is there any way to extend or use the transfer learning approach to "fine-tune" the model and extend vocabulary with a custom corpus?
I really like the new sentenceEmbedding API and would like to use it in a project. However, how would you deal with situations in which there is specific vocabulary that the model most likely had not seen in its training corpus.
For instance, an app that allows you to answer rule questions for board games with vocabulary specific to the game (eg. fanatasy/sci-fi/...).
Is there any way to extend or use the transfer learning approach to "fine-tune" the model and extend vocabulary with a custom corpus?