Debugging

RSS for tag

Discover and resolve issues with your app.

Posts under Debugging tag

200 Posts

Post

Replies

Boosts

Views

Activity

Xcode debugger doesn't pause on breakpoints (simulator SDK < iOS 17)
Hello. I'm seeing an inconsistent behavior where breakpoints I set in my (Swift) iOS app behave normally when I'm debugging on a device or on a simulator running iOS 17.x, but when I try using simulators of iOS 16 or 15 the breakpoints get ignored completely. I also observe that the breakpoints remain solid blue and do NOT adopt the dotted blue outline, as experienced by other users. I've seen a few posts on here and on SO about the general issue of ignored breakpoints (with no conclusive answer AFAIK), but I haven't seen any where the behavior varies with the SDK being used. The behavior is repeatable and predictable (within the same app at least). I am not adding the breakpoints after building/running, and I'm sure the logic reaches the lines with the breakpoints (and again, whenever I switch to an iOS 17 simulator, execution does pause as expected with the exact same breakpoints). Things I've tried and looked into: Clean up project build folder Delete and re-install simulators (iOS 16.4 and 15.5) Deleted the entire derived data directory, as well as the CoreSimulator one. Confirm the build configuration is Debug, and the "Debug executable" option is checked. inspect various build flags mentioned in other posts: {Swift compiler - Code generation - Optimization level - Debug: -0none; Debug information format: DWARF (I also tried DWARF with dSYM with no impact)}. Most of my settings are on the plain vanilla/out of the box side, with only a couple of SPM dependencies, and I've been maintaining the same app for about 5 years and don't think I've come across this behavior before. Currently using Xcode 15.1. Deployment target is 14.0. Thank you.
14
13
7.5k
Apr ’25
App crashing on startup
I am a developer working on an iOS enterprise application. When I deployed the release version to my device, it crashes upon startup. It works fine in debug mode on my device. The app is an upgraded version of Xamarin Form to .NET MAUI. I have attached a crash report. I would appreciate any help/insights on how to resolve. --John
2
0
91
Apr ’25
Calling [NSUserDefaults objectForKey:] crashes as it attempts to insert nil object into dictionary
Hi, I work at OneSignal, a third-party SDK, and have the following two crash reports submitted by a client for the same issue. Because the crash originates from our SDK, even if the root cause may be elsewhere, the onus is on our team to try to resolve this crash. Additionally, my information is limited as this is not our own crash report. I'm trying to figure out why this crash happens and how we can address it within our SDK. Crash Reported: Fatal Exception: NSInvalidArgumentException [NSMutableDictionary __addObject:forKey:]: object cannot be nil Context: Our SDK makes a call to [NSUserDefaults(NSUserDefaults) objectForKey:] on the standardUserDefaults and passes in a non-null key. It appears further up the call stack, a null value is being added to a dictionary. I assume this is the innards of how the search list is generated. Additional Information: The client states that it seems to happen only once per user and the scale is not extremely high but it is increasing. They are unsure what happened and when. They don't have much information about the devices except it has happened on iOS 18. Log 1: 0 CoreFoundation 0x2d5fc __exceptionPreprocess 1 libobjc.A.dylib 0x31244 objc_exception_throw 2 CoreFoundation 0x15548 -[NSMutableDictionary __addObject:forKey:] 3 CoreFoundation 0x20850 -[__NSDictionaryM __apply:context:] 4 CoreFoundation 0x54700 ___CFPrefsDeliverPendingKVONotificationsGuts_block_invoke 5 CoreFoundation 0x52988 __CFDictionaryApplyFunction_block_invoke 6 CoreFoundation 0x52524 CFBasicHashApply 7 CoreFoundation 0x21040 CFDictionaryApplyFunction 8 CoreFoundation 0x7a6b0 _CFPrefsDeliverPendingKVONotificationsGuts 9 CoreFoundation 0x777d0 -[_CFXPreferences _deliverPendingKVONotifications] 10 CoreFoundation 0x776ac __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke 11 CoreFoundation 0x5cf24 normalizeQuintuplet 12 CoreFoundation 0x5cd60 -[_CFXPreferences withSearchListForIdentifier:container:cloudConfigurationURL:perform:] 13 CoreFoundation 0x5cc60 -[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:] 14 CoreFoundation 0x5c8bc _CFPreferencesCopyAppValueWithContainerAndConfiguration 15 Foundation 0xf0dcc -[NSUserDefaults(NSUserDefaults) objectForKey:] 16 OneSignalCore 0xc7c8 -[OneSignalUserDefaults keyExists:] + 61 (OneSignalUserDefaults.m:61) 17 OneSignalCore 0xc8b0 -[OneSignalUserDefaults getSavedBoolForKey:defaultValue:] + 70 (OneSignalUserDefaults.m:70) 18 OneSignalCore 0xbb10 +[OSPrivacyConsentController requiresUserPrivacyConsent] + 59 (OSPrivacyConsentController.m:59) 19 OneSignalCore 0xbc30 +[OSPrivacyConsentController shouldLogMissingPrivacyConsentErrorWithMethodName:] + 75 (OSPrivacyConsentController.m:75) 20 OneSignalCore 0x4418 +[OneSignalConfigManager shouldAwaitAppIdAndLogMissingPrivacyConsentForMethod:] + 50 (OneSignalConfigManager.m:50) 21 OneSignalOSCore 0x537c OSOperationRepo.flushDeltaQueue(inBackground:) + 140 (OSOperationRepo.swift:140) 22 OneSignalOSCore 0x4868 closure #1 in OSOperationRepo.pollFlushQueue() + 84 (OSOperationRepo.swift:84) 23 OneSignalOSCore 0x5078 thunk for @escaping @callee_guaranteed @Sendable () -&gt; () 24 libdispatch.dylib 0x3fa8 _dispatch_client_callout 25 libdispatch.dylib 0x745c _dispatch_continuation_pop 26 libdispatch.dylib 0x1b620 _dispatch_source_latch_and_call 27 libdispatch.dylib 0x1a1e8 _dispatch_source_invoke 28 libdispatch.dylib 0xb42c _dispatch_lane_serial_drain 29 libdispatch.dylib 0xc124 _dispatch_lane_invoke 30 libdispatch.dylib 0x1738c _dispatch_root_queue_drain_deferred_wlh 31 libdispatch.dylib 0x16bd8 _dispatch_workloop_worker_thread 32 libsystem_pthread.dylib 0x3680 _pthread_wqthread 33 libsystem_pthread.dylib 0x1474 start_wqthread Log 2: Fatal Exception: NSInvalidArgumentException 0 CoreFoundation 0x2d5fc __exceptionPreprocess 1 libobjc.A.dylib 0x31244 objc_exception_throw 2 CoreFoundation 0x15548 -[NSMutableDictionary __addObject:forKey:] 3 CoreFoundation 0x168f0 __72-[CFPrefsSource mergeIntoDictionary:sourceDictionary:cloudKeyEvaluator:]_block_invoke 4 CoreFoundation 0x23ecc -[__NSFrozenDictionaryM __apply:context:] 5 CoreFoundation 0x4f82c -[CFPrefsSource mergeIntoDictionary:sourceDictionary:cloudKeyEvaluator:] 6 CoreFoundation 0x783b8 -[CFPrefsSearchListSource alreadylocked_getDictionary:] 7 CoreFoundation 0x77dfc -[CFPrefsSearchListSource alreadylocked_copyValueForKey:] 8 CoreFoundation 0x77d30 -[CFPrefsSource copyValueForKey:] 9 CoreFoundation 0x77ce4 __76-[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:]_block_invoke 10 CoreFoundation 0x77690 __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke 11 CoreFoundation 0x5cf24 normalizeQuintuplet 12 CoreFoundation 0x5cd60 -[_CFXPreferences withSearchListForIdentifier:container:cloudConfigurationURL:perform:] 13 CoreFoundation 0x5cc60 -[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:] 14 CoreFoundation 0x5c8bc _CFPreferencesCopyAppValueWithContainerAndConfiguration 15 Foundation 0xf0dcc -[NSUserDefaults(NSUserDefaults) objectForKey:] 16 OneSignalCore 0xc7c8 -[OneSignalUserDefaults keyExists:] + 61 (OneSignalUserDefaults.m:61) 17 OneSignalCore 0xcbd8 -[OneSignalUserDefaults getSavedDoubleForKey:defaultValue:] + 107 (OneSignalUserDefaults.m:107) 18 OneSignalFramework 0x8964 +[OneSignal shouldStartNewSession] + 350 (OneSignal.m:350) 19 OneSignalFramework 0xc968 +[OneSignalTracker applicationBecameActive] + 83 (OneSignalTracker.m:83) 20 OneSignalFramework 0xb894 -[OneSignalLifecycleObserver didBecomeActive] + 84 (OneSignalLifecycleObserver.m:84) ...... 55 UIKitCore 0x3ee674 -[UIApplication _run] 56 UIKitCore 0x14e88 UIApplicationMain 57 UnityFramework 0x399aef0 -[UnityFramework runUIApplicationMainWithArgc:argv:] + 96 (main.mm:96) 58 ClientsApp 0x412c main + 28 (main.mm:28)
2
0
110
Apr ’25
Unable to Write to App Group Shared Container on Device
Hi everyone, I'm facing an issue where I cannot write a file to a shared App Group container in my tvOS app when running on a real device. My code works perfectly on the simulator, but fails on a physical device with a permissions error. I’ve set up an App Group with a custom identifier (e.g., group.<my.identifier>), and it’s correctly configured in the Capabilities section of Xcode for both my main app and widget targets. Here’s the code I’m using to save a test file: func saveTestFile() { guard let groupURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.<my.identifier>") else { print("Couldn't access the Group URL.") return } let containerURL = groupURL.appendingPathComponent("Library", isDirectory: true) if FileManager.default.isWritableFile(atPath: containerURL.path) { print("Directory IS writable") } else { print("Directory IS NOT writable") } let fileURL = containerURL.appendingPathComponent("test.txt") let content = "Hello App Group!" do { try content.write(to: fileURL, atomically: true, encoding: .utf8) print("File test.txt is saved at: \(fileURL.path)") } catch { print("Error while saving the file: \(error)") } } Console: Directory IS NOT writable Error while saving the file: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “test.txt” in the folder “”." UserInfo={NSFilePath=/private/var/mobile/Containers/Shared/AppGroup//Library/test.txt, NSURL=file:///private/var/mobile/Containers/Shared/AppGroup//Library/test.txt, NSUnderlyingError=0x14387fbe0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}} I’ve tried saving the file in different subdirectories within the App Group container: Directly in groupURL (root of the container). In groupURL.appendingPathComponent("Library"). In groupURL.appendingPathComponent("Caches"). Do you have any ideas what is the problem? Thanks in advance for any help!
1
0
72
Apr ’25
iOS 18.4 is crashing the apps using service workers
After updating to iOS 18.4, our web application (with service workers) crashes on devices that accessed it prior to the update. This issue also affects hybrid mobile apps using the same web application; reinstalling the app resolves it by refetching and reinstalling service workers. Debugging is challenging because clearing the cache or reinstalling the app fixes the problem, and no useful error logs are available. Has anyone encountered similar crashes related to service workers after an iOS update and have any insights into the cause?
1
0
207
Apr ’25
Proper Provisiong Profile for Finder Sync Extension
Hi all, I'm developing a simple Finder Sync Extension, using Xcode 16.3. When running in Debug with Xcode, everything works fine. Instead, when compiling in Release and launching the containing app (by double-clicking on it), the Extension is not recognized (neither loaded) by the system. The only difference between Debug and Release stands in Signing configuration: Debug: Release: As you can see, in Release I'm using a Provisiong Profile, configured with my company's Developer ID. I'm wondering if Capabilities and Entitlements are not what is needed by my app. Anyway, I have no idea what the issue is. Any suggestion will be appreciated. Thank you in advance _Alex
3
0
135
Apr ’25
Unable to open mach-O at path
Hi, there's this point at which a beginner needs to beg for help. Unable to open mach-O at path: /Library/Caches/com.apple.xbs/Binaries/RenderBox/install/Root/System/Library/PrivateFrameworks/RenderBox.framework/default.metallib Error:2 I get this everytime I select a month and year on a custom date picker, I believe because I try to force the ".generateChartData()" for the chart to update. I guess the problem might be that the ".onAppear" and ".onChange" are conflicting with each other? } .onChange(of: showDatePicker) { viewModel.startDate = selectedDate viewModel.generateChartData() } } .onAppear { viewModel.generateChartData() }
1
0
108
Apr ’25
Migrating SwiftUI lifecycle to UIKit's
Hi, everyone I have an app already in production that uses SwiftUI's lifecycle (paired with an AppDelegate). Due to some specific behaviour of the app, we decided to migrate the app to use UIKit's lifecycle, adding the corresponding SceneDelegate to the app, as well as modifying the Info.plist file accordingly to accommodate to these new changes. Although everything seems to work when installing the app from zero, when installing it on top of another version, the screen goes black and the user cannot interact with the app at all unless they reinstall it completely. As I've read online, iOS is reusing the window configuration from the previous execution of the app. I know this because the AppDelegate's application(application:connectingSceneSession:options) is not being called when coming from a previous version of the app. I would love to know what can I do to make this work because, as you may understand, we cannot ask our user base to reinstall the application. Thank you very much.
7
2
1.6k
Apr ’25
Crash on iOS: UIKitCore -[UIApplication _run] with CFRunLoopRun
Hello everyone, I’m experiencing a crash in my iOS application that’s occurring predominantly on devices running iOS 16.6.0. The crash seems to happen on the main thread during a UI operation, specifically within the UIKitCore framework. Crash Log Summary Thread 0 Crashed: 0 libsystem_kernel.dylib 0xca4 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x13b74 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x13e4c mach_msg_overwrite + 540 3 libsystem_kernel.dylib 0x11e8 mach_msg + 24 4 CoreFoundation 0x79024 __CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x7a250 __CFRunLoopRun + 1208 6 CoreFoundation 0x7f3ec CFRunLoopRunSpecific + 612 7 GraphicsServices 0x135c GSEventRunModal + 164 8 UIKitCore 0x39cf58 -[UIApplication _run] + 888 9 UIKitCore 0x39cbbc UIApplicationMain + 340 10 MyApp 0x24050 main + 51 (AppDelegate.swift:51) 11 ??? 0x1d3594dec (Missing) I’ve attached the full crash crashlog.txt and would appreciate any insights or recommendations on how to resolve this issue.
2
1
1.2k
Apr ’25
Interpreting crash log assertionFailure
Hello, I am experiencing crash on TopShelf and I checked all the crashlogs, but I don't know how to interpret it. I see only addresses in the trace logs, so it's really hard to understand what's going on. Is there a way how to symbolicate frames 5 - 17? Does anybody have an idea, what can be wrong? Thanks in advance. 0 libswiftCore.dylib 0x000000019bd33a88 _assertionFailure(_:_:file:line:flags:) + 264 (AssertCommon.swift:147) 1 TopShelf 0x00000001048b998c 0x1045ac000 + 3201420 2 TopShelf 0x0000000104cc04a8 0x1045ac000 + 7423144 3 libdispatch.dylib 0x000000019ab89294 _dispatch_client_callout + 20 (object.m:576) 4 libdispatch.dylib 0x000000019ab8aae0 _dispatch_once_callout + 32 (once.c:52) 5 TopShelf 0x00000001048f4098 0x1045ac000 + 3440792 6 TopShelf 0x00000001048f4930 0x1045ac000 + 3442992 7 TopShelf 0x00000001048cc8bc 0x1045ac000 + 3279036 8 TopShelf 0x00000001045b5a61 0x1045ac000 + 39521 9 TopShelf 0x0000000104ca8841 0x1045ac000 + 7325761 10 TopShelf 0x00000001049e5cc5 0x1045ac000 + 4431045 11 TopShelf 0x0000000104cc0dfd 0x1045ac000 + 7425533 12 TopShelf 0x00000001045b4b95 0x1045ac000 + 35733 13 TopShelf 0x00000001045b4e81 0x1045ac000 + 36481 14 TopShelf 0x00000001045b50e5 0x1045ac000 + 37093 15 TopShelf 0x00000001045b5a61 0x1045ac000 + 39521 16 TopShelf 0x00000001045b54b5 0x1045ac000 + 38069 17 TopShelf 0x00000001045b50e5 0x1045ac000 + 37093 18 libswift_Concurrency.dylib 0x000000019c30aedd completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) + 1 (Task.cpp:497)
5
0
77
Apr ’25
Instrument Recording Failure - CPU counter failed
Hi, I’m encountering an issue while using xctrace & instruments to profile an application on macOS. Specifically, when trying to record a trace using the CPU Profiler template, I get the following errors: Failed to start the recording: configureHardwareCounters: Failed set kpc configuration: Operation not permitted. Unexpected failure: Couriers have returned unexpectedly. macOS Version: 15.3.1 Chip: Apple M4 Pro Xcode Version: Xcode 16.2
4
2
594
Mar ’25
Uikit : -[UIApplication _terminateWithStatus:] + 136 (UIApplication.m:7539)
I have a few crash report from TestFlight with this context and nothing else. No symbols of my application. Crash report is attached. crashlog.crash It crashes at 16H25 (local time paris) and a few minutes after (8) I see the same user doing task in background (they download data with a particular URL in BGtasks) with a Delay that is consistant with a background wait of 5 or 7 minutes. I have no more information on this crash and by the way Xcode refuses to load it and shows an error. ( I did a report via Xcode for this).
0
0
39
Mar ’25
Xcode 15 console logging of system messages
Background I have a SwiftUI app that uses OSLog and the new Logger framework. In my SwiftUI views, I would like to use something like Self._logChanges() to help debug issues. After some trial and error, I can see the messages appear in the System console log for the app I am debugging using the com.apple.SwiftUI subsystem. Problem I'd like to see those same messages directly in Xcode's console window so I can filter them as needed. How do I do that? Thanks! -Patrick
4
1
2.3k
Mar ’25
NavigationLink and ScrollView gestures collide
When the following structure: NavigationStack { ScrollView { NavigationLink(...) } } is presented inside a sheet in SwiftUI, the scroll drag gesture and the link tap gesture collide. If the user happens to begin a scroll gesture on a link, the link will open the moment the finger is lifted, no matter how far it is from its initial touchdown. The issue has already been found (this stack overflow post from 2019), but no solution was provided. I've already filed a report (FB17034020). In the meantime, is there any way to override the touch gesture detection in any manner? This issue is quite inconvenient from a user perspective.
1
1
50
Mar ’25
The Xcode project keeps crashing on launch
Hello, I need a little bit of help. My game keeps crashing on launch no matter what I do. I’ve tried running it in Xcode on my Mac, on my iPhone, and through TestFlight, but I get the same result every time. I’ve tried everything I could find on the internet, and nothing worked. Asking here is my last resort because I’m completely stuck. The game runs fine in Unity, but not so much in Xcode. Can someone help me figure out what I’m doing wrong?Any help would be greatly appreciated. Here is the error log I found by connecting my iPhone to my Mac. To view the logs, I used the Console in the Devices and Simulators section of Xcode. ➤ SecKeyVerifySignature failed: Error Domain=NSOSStatusErrorDomain Code=-50 "rsa_pub_crypt failed" [10:27:36.034791+0200] kernel ➤ Sandbox: [App] deny(1) sysctl-read kern.bootargs [10:27:36.043389+0200] SpringBoard ➤ Live host view super view[(null)] not matching container view ➤ Frame not updated [10:27:36.050473+0200] backboardd ➤ Cycle detected [10:27:36.100799+0200] SpringBoard ➤ Live host view super view[(null)] not matching container view [10:27:36.538361+0200] akd ➤ Error fetching keychain item - Error Domain=NSOSStatusErrorDomain Code=-25300 "no matching items found" [10:27:36.545734+0200] akd ➤ Failed to set last known MID with error (Error Domain=NSOSStatusErrorDomain Code=-25300) [10:27:36.603384+0200] rtcreportingd ➤ Gap in hierarchy: [10:27:36.604536+0200] cloudd ➤ TCP input flags=[R.] state=LAST_ACK [10:27:36.613317+0200] cloudd ➤ TCP input flags=[R] state=CLOSED [10:27:36.648449+0200] kernel ➤ 1 duplicate report for Sandbox: [App] deny(1) sysctl-read kern.bootargs [10:27:36.648484+0200] kernel ➤ Sandbox: [App] deny(1) file-test-existence /private/var/Managed Preferences/mobile/com.apple.CoreMotion.plist [10:27:36.900275+0200] CommCenter ➤ Client is not entitled for request [10:27:37.131555+0200] storekitd ➤ AMSURLSession: Session decoder failed. Error = Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" [10:27:37.131761+0200] storekitd ➤ AMSURLSession: Task completed with error = Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" [10:27:38.137847+0200] kernel ➤ System Policy: [Process] deny(1) file-read-metadata /private/var/mobile/Library/Biome/FlexibleStorage [10:27:38.779536+0200] kernel ➤ Sandbox: [App] deny(2) file-test-existence /private/etc/localtime [10:27:38.942342+0200] mobileassetd ➤ TCP input flags=[R] state=LAST_ACK [10:27:38.963596+0200] kernel ➤ Sandbox: [App] deny(2) file-test-existence /bin/bash [10:27:40.152019+0200] mobileassetd ➤ TCP input flags=[R] state=LAST_ACK [10:27:40.280661+0200] assetsd ➤ Warning: cache_handle_memory_pressure invokedPreformatted text```
2
0
249
Mar ’25
NSString initWithFormat crash on ios18
var format = "%7B%22sign%22%3Anull%2C%22company%22%3A%22%E5%85%84%E5%BC%9F%E6%B5%B7%E6%B4%8B%E7%A7%91%E6%8A%80%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8%22%2C%22businessNo%22%3Anull%2C%22scene%22%3Anull%2C%22interviewCode%22%3A%22767676%22%7D" let message = withVaList([]) { args in let msg = NSString(format: format, arguments: args) print(msg) }
6
0
130
Mar ’25
Crash reports downloaded by Xcode contain impossible call hierarchy
I was just having a look at some crash reports downloaded by Xcode, and I noticed the same wrong pattern I already mentioned here: the crash reports indicate that method A calls method B, which is impossible. In the first crash report below, method MainViewController.showSettings seems to be called by ConfirmMoveViewController.openSourceInFinder, which is impossible. ConfirmMoveViewController.openSourceInFinder is a context menu action in a modal window, and MainViewController.showSettings is in a completely different window and the two methods have no relation whatsoever. In the second crash report below, MainViewController.setSortMode is triggered by the press of a button (and nothing else) but seems to be called by OtherViewController.copy that can be triggered by a context menu (or keyboard shortcut). The two methods have no relation whatsoever. The rest of the stack trace confirm that it's indeed the button that was pressed. This seems to me like a quite serious bug in how macOS creates crash reports. 1.crash 2.crash
6
0
287
Mar ’25