Post

Replies

Boosts

Views

Activity

await UIApplication.shared.beginBackgroundTask inside an async method
Looking for tips here. I've got Swift Concurrency Checking set to Complete - so I'm seeing interesting warnings that I'd like to hear what the proper way to fix this is. I've got an async method that I'm using in a variety of places that I need to specify is a task that needs to complete even if the user goes into the background. It can take 2-60 seconds depending on DNS/network and server responses. func checkRoutineDepartures() async {         var bgTaskId: UIBackgroundTaskIdentifier = .invalid         bgTaskId = await UIApplication.shared.beginBackgroundTask(withName: "checkRoutineDepartures") {             UIApplication.shared.endBackgroundTask(bgTaskId)             bgTaskId = .invalid         } With the complete option, I get a warning Non-sendable type '(() -> Void)?' passed in call to main actor-isolated function cannot cross actor boundary on the completion handler and then on the endBackgroundTask line I get Call to main actor-isolated instance method 'endBackgroundTask' in a synchronous nonisolated context; this is an error in Swift 6 In the docs for both of these, it says I can call them This method can be safely called on a non-main thread. So it seems to me like the headers are incorrectly marking the entire class as Main Actor and missing these methods, or I'm doing something wrong.
2
4
1.2k
Dec ’22
EKObject is now iOS 13+ only?
In the latest SDK EKObject has changed to only be supported in iOS 13 and up. Before it was supported in iOS 5 and up. This means if you try to build an existing app against the iOS 14 SDK and have a minimum target before iOS 13 - you won't be able to build anymore. The online docs also have been updated. This is a sudden change. There was no notice. Its not in the release notes? Is this actually a change or a mistake? Just trying to understand here.
0
0
501
Aug ’20
The data couldn’t be read because it isn’t in the correct format.
All of a sudden today if I try to export our app for Enterprise distribution, I get this error below. So the question is - anyone know why I'm getting this, how to fix it, and so on? It only happens on newly created archives of our app. One major change is that I've enabled bitcode for our app and our frameworks that it uses."The data couldn’t be read because it isn’t in the correct format." In the error log: [BUG] Segmentation fault ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16] And in the crash logs I do see: Process: ruby [99064] Path: /usr/bin/ruby Identifier: ruby Version: 119.50.2 Code Type: X86-64 (Native) Parent Process: Xcode [41202] Responsible: ruby [99064] User ID: 501 Date/Time: 2018-02-15 14:59:24.286 -0700 OS Version: Mac OS X 10.12.6 (16G1212) Report Version: 12 Anonymous UUID: 4245B758-4197-BCB7-7D5D-830E86DAB467 Sleep/Wake UUID: FBC6D67F-A36E-4F7F-98A3-3EE37A5F360F Time Awake Since Boot: 330000 seconds Time Since Wake: 21000 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGABRT) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000438 Exception Note: EXC_CORPSE_NOTIFY VM Regions Near 0x438: --> __TEXT 000000010f533000-000000010f535000 [ 8K] r-x/rwx SM=COW /usr/bin/ruby Application Specific Information: abort() called Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x00007fffd9fe5d42 __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007fffda0d3457 pthread_kill + 90 2 libsystem_c.dylib 0x00007fffd9f4b420 abort + 129 3 libruby.2.0.0.dylib 0x000000010f569f70 rb_bug + 185 4 libsystem_platform.dylib 0x00007fffda0c6b3a _sigtramp + 26 5 ??? 000000000000000000 0 + 0 6 libruby.2.4.1.dylib 0x000000010faad19a st_init_table_with_size + 74 (st.c:572) 7 libruby.2.4.1.dylib 0x000000010f9b3f4e rb_enc_init + 110 (encoding.c:593) 8 libruby.2.4.1.dylib 0x000000010f9b5325 rb_usascii_encoding + 21 (encoding.c:1338) 9 libruby.2.4.1.dylib 0x000000010fad70c7 rb_intern + 23 (symbol.c:606) 10 libruby.2.4.1.dylib 0x000000010f988043 rb_define_module + 19 (class.c:773) 11 sqlite3_native.bundle 0x000000010f953e72 Init_sqlite3_native + 18 (sqlite3.c:129) 12 libruby.2.0.0.dylib 0x000000010f540651 dln_load + 213 13 libruby.2.0.0.dylib 0x000000010f654695 rb_vm_call_cfunc + 474 14 libruby.2.0.0.dylib 0x000000010f571e7f rb_require_safe + 1775 15 libruby.2.0.0.dylib 0x000000010f657ad6 0x10f53f000 + 1149654 16 libruby.2.0.0.dylib 0x000000010f649ae1 0x10f53f000 + 1092321 17 libruby.2.0.0.dylib 0x000000010f6537a1 0x10f53f000 + 1132449 18 libruby.2.0.0.dylib 0x000000010f65370c rb_iseq_eval + 372 19 libruby.2.0.0.dylib 0x000000010f571660 0x10f53f000 + 206432 20 libruby.2.0.0.dylib 0x000000010f571de9 rb_require_safe + 1625 21 libruby.2.0.0.dylib 0x000000010f657ad6 0x10f53f000 + 1149654 22 libruby.2.0.0.dylib 0x000000010f6573c3 0x10f53f000 + 1147843 23 libruby.2.0.0.dylib 0x000000010f649ae1 0x10f53f000 + 1092321 24 libruby.2.0.0.dylib 0x000000010f6537a1 0x10f53f000 + 1132449 25 libruby.2.0.0.dylib 0x000000010f6542fa rb_iseq_eval_main + 138 26 libruby.2.0.0.dylib 0x000000010f56e53d 0x10f53f000 + 193853 27 libruby.2.0.0.dylib 0x000000010f56e472 ruby_run_node + 54 28 ruby 0x000000010f5344fe main + 91 29 libdyld.dylib 0x00007fffd9eb7235 start + 1
1
0
4.3k
Feb ’18
State Restoration Debugging
I’m curious if anyone has some helpful hints when state restoration doesn’t work. I have the following situation:UIWindow subclass-UITabViewController subclassEach tab has:—UISplitViewController subclass—UINavigationController subclass -UIVC Master subclass -UIVC Detail subclassIts all in code - no storyboard. I’m creating the window, tab, split, in the willFinishLaunching so that its all ready for state restoration. I have the restoration identifiers setup. I have the detail view controller conforming to UIViewControllerRestoration and viewControllerWithRestorationIdentifierPath does get called. I’m creating the detail VC, and I’m seeing it all get decoded properly.I’ve read every article I can find on state restoration, the docs, etc… and I just can’t find anything that provides common reasons for it not working. Here is what’s driving me crazy: I got it all working once. Then I went to apply it to another tab and its View controllers, and I’ve never gotten it to work again.I’ve always hated working with state restoration, and I’m about to go old-school.
1
0
790
Oct ’16
currentUserNotificationSettings causes a delay/freeze of 20 seconds or so
In the last month or so I've started getting reports that people starting our app can take 10-20 seconds or more in a freeze where nothing happens. We've logged extensively and isolated it to this call:UIUserNotificationSettings* currentSettings = [[UIApplication sharedApplication] currentUserNotificationSettings];For these people, any call to that method causes the device to freeze for that period of time. Here is an example stack trace from a device we could reproduce this with:https://dl.dropboxusercontent.com/u/9452258/Screen%20Shot%202016-06-06%20at%202.58.14%20PM.pngAny ideas on if we are doing something that could be the problem?
1
0
773
Jun ’16