Currently I am testing an almost finished App. In general it is working well.
But I have seen that the App is crashing (reproduceable, but at random times), when I change fast between a view controller that is using MapKit and CoreLocation and a plain one just displaying some simple buttons.
The crash happens after returning to the plain VC. Such fast changes are not the usual usage scenario of a user, I have done that just because testing is sooo boring ;-) - but now I know that there is an error somewhere.
Does anyone have an idea, where to look? See the error report from the device below - it looks always the same. The error messages in Xcode are different, but always something with unrecognized selector. Btw. I do not use performSelector:withObject: that must come from the framework.
I am tending to guess, that there are some internal initializing tasks from MKMapView or CoreLocation that are not finished when returning so fast from this VC and that these are causing the problem?
Error Message in Xcode:
2012-08-25 17:26:20.375 Kanal01[4070:707] -[__NSCFArray
mapView:didUpdateUserLocation:]: unrecognized selector sent to
instance 0x10b030 2012-08-25 17:26:20.384 Kanal01[4070:707] ***
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[__NSCFArray
mapView:didUpdateUserLocation:]: unrecognized selector sent to
instance 0x10b030' *** First throw call stack: (0x374fa88f
0x351ff259 0x374fda9b 0x374fc915 0x37457650 0x36f13e63 0x374591fb
0x37495ab9 0x36f09b21 0x36badde3 0x36bad785 0x36ba7e4f 0x374ceb01
0x374ce12f 0x374cd351 0x374504a5 0x3745036d 0x33c0f439 0x311fccd5
0xa9eed 0xa9e88) terminate called throwing an exception
Content of Device Log:
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes:
KERN_INVALID_ADDRESS at 0x00000000 Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0
Crashed: 0 libobjc.A.dylib 0x36fe8f7e 0x36fe5000
+ 16254 1 MapKit 0x337b9e5c 0x3378b000 + 192092 2 CoreFoundation 0x30c0f1f4 0x30bf7000 +
98804 3 CoreFoundation 0x30c4bab2 0x30bf7000 +
346802 4 MapKit 0x337afb1a 0x3378b000 +
150298 5 CoreLocation 0x33ccaddc 0x33cc2000 +
36316 6 CoreLocation 0x33cca77e 0x33cc2000 +
34686 7 CoreLocation 0x33cc4e48 0x33cc2000 +
11848 8 CoreFoundation 0x30c84afa 0x30bf7000 +
580346 9 CoreFoundation 0x30c84128 0x30bf7000 +
577832 10 CoreFoundation 0x30c8334a 0x30bf7000 +
574282 11 CoreFoundation 0x30c0649e 0x30bf7000 +
62622 12 CoreFoundation 0x30c06366 0x30bf7000 +
62310 13 GraphicsServices 0x32c80432 0x32c7c000 +
17458 14 UIKit 0x30369cce 0x30338000 +
203982 15 Kanal01 0x00069fde 0x68000 +
8158 16 Kanal01 0x00069f78 0x68000 +
8056
Related
I am writing an iOS app, using Swift.
The app crashes some time and what I get in the console is this:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: updated_objectIDs)'
*** First throw call stack:
(0x1858151b8 0x18424c55c 0x1856f5a0c 0x1856ffa40 0x187bc3540 0x187b4edf8 0x187b399bc 0x187b329dc 0x1857c20c0 0x1857bfcf0 0x1857c0180 0x1856ee2b8 0x1871a2198 0x18b7357fc 0x18b730534 0x100069440 0x1846d15b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I am trying to figure out where this is coming from.
I have no idea at the moment what parts of my code could cause this crash.
What is the proper way to find more information and possibly find the part in code that is causing this crash?
You can create a new Exception breakpoint.This will help you find out line number where the exception is occurring in Xcode.
Check below link for more details.
Xcode doesn't show the line that causes a crash
Objective C - getting line number or full stack trace from debugger error?
So, I have tried the suggested approaches. No luck yet.
Maybe adding the rest of the log can help people getting more information and maybe help me figure out what is going on. This is what I see in the console when the app crashes:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: updated_objectIDs)'
*** First throw call stack:
(
0 CoreFoundation 0x000000010de39d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010d2f521e objc_exception_throw + 48
2 CoreFoundation 0x000000010dd4fd87 -[__NSDictionaryM setObject:forKey:] + 1047
3 CoreFoundation 0x000000010ddb8729 -[NSMutableDictionary addEntriesFromDictionary:] + 329
4 CoreData 0x000000010da00b14 -[NSManagedObjectContext(_NSInternalChangeProcessing) _createAndPostChangeNotification:deletions:updates:refreshes:deferrals:wasMerge:] + 1844
5 CoreData 0x000000010d9646f7 -[NSManagedObjectContext(_NSInternalChangeProcessing) _postRefreshedObjectsNotificationAndClearList] + 215
6 CoreData 0x000000010d962dbf -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] + 111
7 CoreData 0x000000010d93c143 _performRunLoopAction + 339
8 CoreFoundation 0x000000010ddde267 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
9 CoreFoundation 0x000000010ddde1d7 __CFRunLoopDoObservers + 391
10 CoreFoundation 0x000000010ddc2f8e __CFRunLoopRun + 1198
11 CoreFoundation 0x000000010ddc2884 CFRunLoopRunSpecific + 420
12 GraphicsServices 0x000000011234fa6f GSEventRunModal + 161
13 UIKit 0x000000010f060c68 UIApplicationMain + 159
14 App 0x000000010adae2ff main + 111
15 libdyld.dylib 0x00000001113a768d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
in the exception I'm seeing: setObjectForKey and a key of updated_objectIDs.
There's a couple things I would do to track this down. First thing I might try would be to search for updated_objectIDs and see where it might be getting passed into setObjectForKey.
Then log the address (or description) of the object being passed in at that point and you might catch it as it's happening.
Even better (and what I do in my own work) is to set a breakpoint on all exceptions. You can do it by following the steps in this answer in this closely related question.
Then, when the exception fires, Xcode will stop at that line of code.
I tested my app on iPhone and iPad devices and it works fine, also I tested it on iOS 10.1.1 and on IPV6 network and it also works fine but after uploading my app to the app store, it is rejected because it crashes when login if the device is offline or on Wifi. They gave me a crash report and after I symplocited it, I get thhis Info :
Date/Time: 2016-11-01 10:07:03.2150 -0700
Launch Time: 2016-11-01 10:05:21.7124 -0700
OS Version: iPhone OS 10.1 (14B72)
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001000f18c0
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [0]
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 MyApp -[FIRMessagingSecureSocket closeStream:] (in MyApp) + 56
1 MyApp -[FIRMessagingRmq2PersistentStore openDatabase:] (in MyApp) + 228
2 MyApp -[FIRMessagingReceiver didSendDataMessageWithID:] (in MyApp) + 128
3 Foundation 0x00000001835e08f8
4 CoreFoundation 0x0000000182aa48f4
5 CoreFoundation 0x0000000182aa4608
6 CoreFoundation 0x0000000182aa3ec4
7 CoreFoundation 0x0000000182aa1ac0
8 CoreFoundation 0x00000001829d0048
9 GraphicsServices 0x0000000184456198
10 UIKit 0x00000001889b42fc
11 UIKit 0x00000001889af034
12 MyApp -[FIRMessagingClient tryToConnect] (in MyApp) + 212
13 libdyld.dylib 0x00000001819b45b8
update :
I published new version put also get this crash log
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001000a1658
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [0]
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 MyApp [FIRAMeasurement setUserAttributeOnWorkerQueue:] (in MyApp) + 580
1 MyApp [FIRAMeasurement uploadData] (MyApp) + 180 0x100054000 + 303808
2 MyApp [FIRAMeasurement reportOSUpdateOnWorkerQueue] (in PetCasa Vet) + 124
3 Foundation 0x0000000187acc8f8 0x1879c1000 + 1095928
4 CoreFoundation 0x0000000186f908f4 0x186eb3000 + 907508
5 CoreFoundation 0x0000000186f90608 0x186eb3000 + 906760
6 CoreFoundation 0x0000000186f8fec4 0x186eb3000 + 904900
7 CoreFoundation 0x0000000186f8dac0 0x186eb3000 + 895680
8 CoreFoundation 0x0000000186ebc048 0x186eb3000 + 36936
9 GraphicsServices 0x0000000188942198 0x188936000 + 49560
10 UIKit 0x000000018cea02fc 0x18ce25000 + 504572
11 UIKit 0x000000018ce9b034 0x18ce25000 + 483380
12 MyApp 0x00000001000907d8 (in MyApp) + 448
13 libdyld.dylib 0x0000000185ea05b8 0x185e9c000 + 17848
and this log crash :
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001000e5658
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [0]
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 MyApp 0x00000001000e5658 (in MyApp) + 1060
1 MyApp [FIRMessagingConnection loginRequestWithToken:authID:] (in MyApp) + 300
2 MyApp [FIRMessagingConnection initWithAuthID:token:host:port:runLoop:rmq2Manager:gcmManager:] (in MyApp) + 32
3 Foundation 0x0000000187acc8f8 0x1879c1000 + 1095928
4 CoreFoundation 0x0000000186f908f4 0x186eb3000 + 907508
5 CoreFoundation 0x0000000186f90608 0x186eb3000 + 906760
6 CoreFoundation 0x0000000186f8fec4 0x186eb3000 + 904900
7 CoreFoundation 0x0000000186f8dac0 0x186eb3000 + 895680
8 CoreFoundation 0x0000000186ebc048 0x186eb3000 + 36936
9 GraphicsServices 0x0000000188942198 0x188936000 + 49560
10 UIKit 0x000000018cea02fc 0x18ce25000 + 504572
11 UIKit 0x000000018ce9b034 0x18ce25000 + 483380
12 MyApp [FIRInstanceIDRegistrationClient parseToken:authToken:withRequestID:handler:] (in MyApp) + 564
13 libdyld.dylib 0x0000000185ea05b8 0x185e9c000 + 17848
From apple documentation
Trace Trap [EXC_BREAKPOINT // SIGTRAP]
......
......
Swift code will terminate with this exception type if an unexpected
condition is encountered at runtime such as:
1- a non-optional type with a nil
2- value a failed forced type conversion
In my app I use location and I send it to backend, and it works fine, but when opening app at first time, system show alert to say that my app want to use your location allow or not allow, if user didn't allow so location methods will not work and location will be nil and unfortunately I didn't check if location is nil so when unwrap it app crashed, it's my mistake.
Please send message to the Apple review team about same and ask to them
"We tested application on iPhone 6, 6s, 7 and 7+ with iOS 10.x and application works perfect in IPV6 network, We follow following process for IPV6 network: http://www.brianjcoleman.com/tutorial-how-to-test-your-app-for-ipv6-compatibility/" and request to them your event will be held on the coming week so, please release application to store asap and let me know the flow of the application, where you find issue or crashes.
It works, I had done same thing with 4 application and they approved.
I'm currently trying to run on Xcode an app I ve made with Qt, but when I try to run it on Xcode i get this Exception :
dyld: warning, Ignoring DYLD_IMAGE_SUFFIX because DYLD_ROOT_PATH is used.
2016-10-10 15:37:04.777 CMP[2206:654538] *** Assertion failure in void _UIApplicationMainPreparations(int, char **, NSString *__strong, NSString *__strong)(), /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UIApplication.m:3702
2016-10-10 15:37:04.783 CMP[2206:654538] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to instantiate the UIApplication subclass instance. No class named NSApplication is loaded.'
*** First throw call stack:
(
0 CoreFoundation 0x06a27494 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x07c4fe02 objc_exception_throw + 50
2 CoreFoundation 0x06a2732a +[NSException raise:format:arguments:] + 138
3 Foundation 0x05eba390 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 102
4 UIKit 0x04703177 _UIApplicationMainPreparations + 645
5 UIKit 0x04702e73 UIApplicationMain + 90
6 CMP 0x0004f6f6 qt_main_wrapper + 678
7 libdyld.dylib 0x0b53fa25 start + 1
8 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
anyone can help please ?
In your app's info.plist, make sure you change the NSPrincipalClass key to the name of your subclass. This'll make Cocoa instantiate the correct class when the applications loads - you shouldn't have to do anything other than that to get your subclass working. Also, take a look at this link it may also add some insights to your question. Demystifying NSApplication
If your application startup is instantiated programmatically & you hit this problem, see if there's an NSPrincipalClass key in your Info.plist. If there is, remove it & see what happens.
Even though the iOS doc says:
NLayoutManager, NSTextStorage, and NSTextContainer can be accessed
from subthreads as long as the app guarantees the access from a single
thread.
I encountered this exception occasionally:
Terminating app due to uncaught exception
'NSInternalInconsistencyException', reason: 'Only run on the main
thread!'
Here is the backtrace:
Exception Type: SIGABRT
Exception Codes: #0 at 0x197bca58c
Crashed Thread: 7
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only run on the main thread!'
Last Exception Backtrace:
0 CoreFoundation 0x000000018afd2f50 __exceptionPreprocess + 132
1 libobjc.A.dylib 0x00000001974dc1fc objc_exception_throw + 56
2 CoreFoundation 0x000000018afd2e10 +[NSException raise:format:arguments:] + 112
3 Foundation 0x000000018bb0ae20 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 84
4 UIFoundation 0x00000001940f0654 -[NSLayoutManager(NSPrivate) _resizeTextViewForTextContainer:] + 412
5 UIFoundation 0x00000001940f0318 -[NSLayoutManager(NSPrivate) _recalculateUsageForTextContainerAtIndex:] + 1748
6 UIFoundation 0x000000019411ec2c _enableTextViewResizing + 236
7 UIFoundation 0x0000000194123e18 -[NSLayoutManager textContainerForGlyphAtIndex:effectiveRange:] + 484
8 UIFoundation 0x0000000194125c60 -[NSLayoutManager glyphRangeForTextContainer:] + 352
One thing to notice is that my NLayoutManager is attached to a UITextView. You can think it as a normal UITextView that is used to do text layout in background thread.
So does it mean that contradicting what the doc says, NLayoutManager can not be safely used on a single background thread if it is attached to a UITextView?
It seems to me that note in the docs actually explains the problem. Since you're using a layout manager attached to a UITextView, you can't guarantee it's being accessed from a single thread. It's best to assume that the text view could access the layout manager at any time, especially if the view is on screen. There's no way for you to know exactly how it's using the layout manager, but it's a safe bet that it's happening on the main thread.
You can have your background thread create a separate NSLayoutManager, NSTextStorage, and NSTextContainer, do all your layout calculations, and then apply those calculations on the main thread.
I keep receiving this crash report and I can't figure out where the problem is.
I understand that SIGSEGV exception type is usually due to a memory management issue.
According to line 9, the crash occurs when function cxx_destruct is called inside the SoundsViewController, is it right? I see in my code that line 182 in this controller is the end of the - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath function.
Does it mean that there're some variables that are not released properly? How do I find them? I enabled Zombie, which helped me to fix another crash but nothing about this one.
I'll appreciate any help. Thank you!
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0xe15e7790
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x38656b26 +[Protocol load] + 1289
1 Foundation 0x2ec6803b -[NSThread description] + 1710
2 CoreFoundation 0x2e25018b -[__NSCFLocale initWithLocaleIdentifier:] + 20334
3 CoreFoundation 0x2e24f65b -[__NSCFLocale initWithLocaleIdentifier:] + 17470
4 CoreFoundation 0x2e24de4f -[__NSCFLocale initWithLocaleIdentifier:] + 11314
5 CoreFoundation 0x2e1b8ce7 0x2e1b1000 + 31975
6 CoreFoundation 0x2e1b8acb 0x2e1b1000 + 31435
7 GraphicsServices 0x32ed9283 -[_UIFontExtraData dealloc] + 25990
8 UIKit 0x30a5aa41 -[UIScrollView _addContentSubview:atBack:] + 1492
9 MyApp1.2.0 0x0004325f -[SoundsViewController .cxx_destruct] + 182
You can refer this link
http://kevincupp.com/2011/05/12/symbolicating-ios-crash-logs.html
This problem is because of deallocation of SoundsViewController.
Check retain values of SoundsViewController.
Turn on Zombie detection in Instruments. This looks on the face of it like a dangling delegate (i.e. some object is trying to invoke a delegate reference, but the delegate target has been unloaded from memory). You could use some instrumentation to track it down.