Post

Replies

Boosts

Views

Activity

SwiftUI navigationDestination called twice
Xcode 16.0 beta 4 (16A5211f) iOS 18.0 beta 4 In SwiftUI, I have a TabView and a NavigationStack that contains a List in one of the tabs. In iOS 18 beta 4 simulator the following happens: when I first click on a different tab in the TabView and the back to the original tab and then click on a list item, navigationDestination is triggered twice. In the simulator, the destination detail view is pushed twice on the stack. This does not happen when running the same app with the same Xcode version but in iOS 17.0 simulator. It this a known bug or could it be some problem in my code? Unfortunately it's a bit difficult to exctract a simple example demonstrating the issue as this is a complex project.
1
1
352
Aug ’24
requestWhenInUseAuthorization Crash iOS 18 Beta 4
When I call requestWhenInUseAuthorization in state kCLAuthorizationStatusNotDetermined on iOS 18 Beta 4 in the simulator, all my apps just terminate without any error message in the Xcode console (black screen with an activity indicator for a second or two and then it goes back to the springboard). I do have the NSLocationWhenInUseUsageDescription set in my Info.plist file. When running the exact same apps in Xcode 16.0 beta 4 (16A5211f) but with a iOS 17 simulator attached, it is working as expected by showing the location authorization dialog. Is this a known issue or am I missing something?
4
1
674
Jul ’24
startAccessingSecurityScopedResource Crash
I have gotten the following crash now two times in an app that is otherwise used a lot and is running fine: Reason: -[NSNull startAccessingSecurityScopedResource]: unrecognized selector sent to instance 0x1f277c230 Stacktrace: ( 0 CoreFoundation 0x000000019c48087c B37A1273-B0C2-312E-9E0B-7143FB645C69 + 968828 1 libobjc.A.dylib 0x000000019479fc00 objc_exception_throw + 60 2 CoreFoundation 0x000000019c51119c B37A1273-B0C2-312E-9E0B-7143FB645C69 + 1560988 3 CoreFoundation 0x000000019c3c5ff8 B37A1273-B0C2-312E-9E0B-7143FB645C69 + 204792 4 CoreFoundation 0x000000019c506b10 _CF_forwarding_prep_0 + 96 5 UIKitCore 0x000000019edae6a8 F1A8BD61-9CF2-3054-B622-CB63D6CEB4CB + 8349352 6 QuickLook 0x000000020ea213b4 D43C66FB-A39B-304E-A81B-8ADBFAAE2882 + 308148 7 QuickLook 0x000000020ea415bc D43C66FB-A39B-304E-A81B-8ADBFAAE2882 + 439740 8 QuickLook 0x000000020ea3ff38 D43C66FB-A39B-304E-A81B-8ADBFAAE2882 + 433976 9 QuickLook 0x000000020ea40378 D43C66FB-A39B-304E-A81B-8ADBFAAE2882 + 435064 10 libdispatch.dylib 0x00000001a434f6a8 89420547-98A3-352A-AD2B-BBCB6006FB29 + 9896 11 libdispatch.dylib 0x00000001a4351300 89420547-98A3-352A-AD2B-BBCB6006FB29 + 17152 12 libdispatch.dylib 0x00000001a435f998 89420547-98A3-352A-AD2B-BBCB6006FB29 + 76184 13 libdispatch.dylib 0x00000001a435f5b0 _dispatch_main_queue_callback_4CF + 44 14 CoreFoundation 0x000000019c3cb20c B37A1273-B0C2-312E-9E0B-7143FB645C69 + 225804 15 CoreFoundation 0x000000019c3c7f18 B37A1273-B0C2-312E-9E0B-7143FB645C69 + 212760 16 CoreFoundation 0x000000019c3c7668 CFRunLoopRunSpecific + 608 17 GraphicsServices 0x00000001df7925ec GSEventRunModal + 164 18 UIKitCore 0x000000019e7e42b4 F1A8BD61-9CF2-3054-B622-CB63D6CEB4CB + 2278068 19 UIKitCore 0x000000019e7e38f0 UIApplicationMain + 340 20 MyApp 0x0000000102c06280 MyApp + 483968 21 dyld 0x00000001bee1adcc A795AD37-6266-385E-95E6-C1CA804C926E + 24012 ) The symbol MyApp + 483968 just resolves to the main() function. I'm not using this startAccessingSecurityScopedResource anywhere in my app. What could I do to debug this issue?
0
0
311
Nov ’23
Modal Activity Indicator - Is there a standard or best practice?
Every once in a while I find myself in need of a modal activity indicator that completely blocks the app (except for the activity indicator itself being tappable and therefore acting as a cancel button). I have always implemented my own view for that. The screenshot is showing my current implementation in SwiftUI. My question: why isn't there a standard iOS provided view for that scenario? Is there a best practice to that? Or am I missing something? Isn't it a common scenario having to block the app until an operation is completed like in the registration view of the attached screenshot, where the user has to wait for the network operation to finish?
0
1
563
May ’23
NSDateFormatter single digit hour for format "HH"
I'm generating a date for a JSON file like so: NSDateFormatter *dateFormatterIso8601 = [NSDateFormatter new]; [dateFormatterIso8601 setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZZZ"]; [jsonDict setObject:[dateFormatterIso8601 stringFromDate:startDate] forKey:@"start"]; How is it possible that this is producing a JSON file with a date string of 2022-07-12T4:04:23GMT+02:00? There is a leading 0 missing for the hour. Is this a known bug?
2
0
859
Jul ’22
What is the logic of autocapitalizationType and the corresponding global setting?
In the lastest iOS 15 if found the following to be the case regarding the combination of the global autocapitalization setting in the iOS Settings app and the autocapitalizationType property: | Global setting | autocapitalizationType | Result (does it capitalize? | |----------------|-------------------------|-----------------------------| | on | Sentences | yes | | on | not set | no | | off | Sentences | no | | off | not set | no | What is the logic behind this? On a side note, I also believe that in the second row of the above table, we had a 'yes' in earlier versions of iOS.
3
0
725
May ’22
Exception reason in Xcode Organizer
Usually when a crash is happening on iOS when the simulator or device is attached to Xcode I get a crash reason like the following example: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSJSONSerialization dataWithJSONObject:options:error:]: value parameter is nil' When I look at the crashes of my published app in the Xcode Organizer using "Open in Project..." I see on which line of code the crash did happen. But is it also possible to get a reason for the crash like the above? I'm asking this about Xcode Version 13.0.
12
0
3.2k
Dec ’21
"Open in..." for images
I'm using the following code in my Info.plist to get my app to appear in the "Open in.." menu via the sharing button for PDF files: <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeName</key> <string>PDF</string> <key>LSHandlerRank</key> <string>Alternate</string> <key>LSItemContentTypes</key> <array> <string>com.adobe.pdf</string> </array> </dict> </array> This is working fine. But I cannot get the same effect for any type of image file. I was trying to add this according to some Stackoverflow posts: <dict> <key>CFBundleTypeName</key> <string>public.jpeg</string> <key>LSHandlerRank</key> <string>Alternate</string> <key>LSItemContentTypes</key> <array> <string>public.jpeg</string> <string>public.jpg</string> </array> </dict> <dict> <key>CFBundleTypeName</key> <string>public.png</string> <key>LSHandlerRank</key> <string>Alternate</string> <key>LSItemContentTypes</key> <array> <string>public.png</string> </array> </dict> However, it is not working for images. Is this supported? Should it work?
0
0
708
Sep ’21
"unable to dequeue a cell with identifier" only on iPadOS 15.0
I have a UITableView based up. It is running fine on all iOS versions including 15.0. It is also running fine on all iPadOS versions up to 14.x. But only on iPadOS 15.0 it crashes with the following error message: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier TextCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard' Is this a know issue? How can I debug it to figure out where the problem lies? Note that I actually do register the NIB as follows in viewDidLoad: static NSString *reuseIdentifierTextCell = @"TextCell"; [self.tableView registerNib:[UINib nibWithNibName:@"ChatTextCellCondensed" bundle:nil] forCellReuseIdentifier:reuseIdentifierTextCell]; It is crashing at this line in cellForRowAtIndexPath: cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifierTextCell forIndexPath:indexPath]; Thanks!
6
0
3.0k
Sep ’21
What are expected values for backgroundTimeRemaining?
Back in 2018 I used to get times in the range from 140 to 170 seconds when calling [UIApplication sharedApplication].backgroundTimeRemaining. Today running on the latest iOS 14 Beta I get about 10 to 20 seconds. My questions: Is this documented somewhere? What times can be expected with which version of iOS? Did you experience the same issue? Is there a way to request more time? (I would need about 60 seconds)
1
0
590
Sep ’20
Silent Background Push in iOS 13
We've used to be able to send content-available=1 silent push messages in a reliable way to an app to trigger functionality while the app was running. Since iOS 13 this has become a big problem becuase of this new statement: "The number of background notifications allowed by the system depends on current conditions, but don’t try to send more than two or three per hour."(https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app?language=objc). According to my tests, you simply cannot rely on background messages being delivered to the app (even with apns-priority and apns-push-type all correctly set according to the docs).One very ugly way to work around this is to send apns-push-type=alert type messages with no visible content and with a sound that points to a 0 byte audiofile. Certainly not a sustainable way to solve the problem.Is there any way to send a message to an app in a reliable way other than to implement a permanently open socket by yourself?
3
0
2.8k
Nov ’19