I'm working through the Core Data Utility at http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreDataUtilityTutorial/Articles/00_introduction.html#//apple_ref/doc/uid/TP40001800-CH202-TP1
I've stumbled on a rather nasty crash SIG_ABRT on the line that reads:
[moc save:&error]
This is the output in the debug:
2010-07-25 22:24:01.665 CoreDataUtilityTutorial[1607:a0f] -[NSCFNumber timeIntervalSinceReferenceDate]: unrecognized selector sent to instance 0x200022100
2010-07-25 22:24:01.666 CoreDataUtilityTutorial[1607:a0f] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFNumber timeIntervalSinceReferenceDate]: unrecognized selector sent to instance 0x200022100'
*** Call stack at first throw:
(
0 CoreFoundation 0x00007fff87e71cc4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x00007fff840ee0f3 objc_exception_throw + 45
2 CoreFoundation 0x00007fff87ecb140 +[NSObject(NSObject) doesNotRecognizeSelector:] + 0
3 CoreFoundation 0x00007fff87e43cdf ___forwarding___ + 751
4 CoreFoundation 0x00007fff87e3fe28 _CF_forwarding_prep_0 + 232
5 CoreData 0x00007fff881baede -[NSXMLDocumentMap getXMLAttributeValueFromObject:forAttribute:] + 478
6 CoreData 0x00007fff881be7c8 -[NSXMLDocumentMap nodeFromManagedObject:objectIDMap:] + 1160
7 CoreData 0x00007fff881bb67c -[NSXMLDocumentMap addObject:objectIDMap:] + 140
8 CoreData 0x00007fff8817d400 -[NSMappedObjectStore _addObject:objectIDMap:] + 32
9 CoreData 0x00007fff8817c98f -[NSMappedObjectStore executeSaveChangesRequest:withContext:] + 1343
10 CoreData 0x00007fff88177599 -[NSMappedObjectStore executeRequest:withContext:] + 105
11 CoreData 0x00007fff88145051 -[NSPersistentStoreCoordinator(_NSInternalMethods) executeRequest:withContext:] + 545
12 CoreData 0x00007fff88179123 -[NSManagedObjectContext save:] + 323
13 CoreDataUtilityTutorial 0x00000001000015b7 main + 303
14 CoreDataUtilityTutorial 0x0000000100000cac start + 52
15 ??? 0x0000000000000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Anyone have an idea? I rechecked the code to see if I mistyped something but nothing is wrong...
Thanks in advance.
Without your actual code, this is a wild stab in the dark, but it looks as if your store is improperly configured at some juncture. Specifically, it looks as if the runtime is expecting a date, but the store has a number.
This could result from making changes to a model without doing a full recompile, maybe.
It could of course be something completely different, but without your specific code, or at the very least a diff against the finished example project as supplied with the tutorial, this is pretty difficult to troubleshoot.
(Another, not impossible, alternative, is that the tutorial was written to assume a specific, earlier version of Mac OS X, like 10.4 or 10.5. This could also result in problems, especially if the default settings for a Core Data project has changed, and this is a result of using the XML store over, say, the SQLite store.)
Looks like the crash is somewhere in the XML code, not the core data code.
Related
So I've got this weird SIGSEGV happening at very few (less than 1%) of my users…
From the stack trace it looks like an over-release
Thread 0 Crashed:
0 libobjc.A.dylib 0x00007fff9a3f916f objc_release + 31
1 libobjc.A.dylib 0x00007fff9a3f7ac4 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 475
2 CoreFoundation 0x00007fff9cc5c102 _CFAutoreleasePoolPop + 49
3 Foundation 0x00007fff96992cb6 -[NSAutoreleasePool drain] + 152
4 AppKit 0x00007fff9138409b -[NSApplication run] + 892
5 AppKit 0x00007fff91306520 NSApplicationMain + 1175
6 RailModeller Pro 0x000000010b60578b main (main.m:30)
7 libdyld.dylib 0x00007fff9a36b5ad start + 0
..but no matter what I try,
even with the very same data,
following the exact same steps as the users,
same OS/patch level,
using Address Sanitizer (Xcode 7.3),
using Zombies instrument,
using Guard Malloc
all appears to be fine.
The function crashing is a pretty common one in the app and I'd be drowning in bug reports (both from the automated bug reporting system as well as users getting in touch) if this were a more common issue.
However, to these (<1%) users the app appears effectively unusable.
Any hints on how to track down this issue much appreciated!
I don't use PhotosUI framework in any place of my app .Don't know why I got crash report from PhotosUI .
Here is crash report from Crashlytics .
0 CoreFoundation __exceptionPreprocess + 130
1 libobjc.A.dylib objc_exception_throw + 38
2 CoreFoundation -[NSObject(NSObject) doesNotRecognizeSelector:] + 202
3 CoreFoundation ___forwarding___ + 706
4 CoreFoundation _CF_forwarding_prep_0 + 24
5 MyApp UICollectionViewFlowLayout+NoFade.m line 42
-[UICollectionViewFlowLayout(NoFade)noFadeFinalLayoutAttributesForDisappearingItemAtIndexPath:]
6 PhotosUI -[PUSectionedGridLayout finalLayoutAttributesForDisappearingItemAtIndexPath:]
-[PUSectionedGridLayout noFadeFinalLayoutAttributesForDisappearingItemAtIndexPath:]: unrecognized selector sent to instance 0x16d56160
It crashed because my UICollectionViewFlowLayout+NoFade tried to call noFadeFinalLayoutAttributesForDisappearingItemAtIndexPath
which is not available PUSectionedGridLayout
But I didn't use PUSectionedGridLayout in any of my code. Is it happen when users select to pick photo from album or something ? I am not able to reproduct this crashes. Any solution for this ?
Thanks
PUSectionedGridLayout looks to be part of the photos UI internals so it would not be a surprise that it is in your call stack if you were using the photos UI.
https://github.com/EthanArbuckle/IOS-7-Headers/blob/master/PrivateFrameworks/PhotosUI.framework/PUSectionedGridLayout.h
However, since you say you are not, at least not directly, the questions is could it be coming in indirectly via either a third party library or an image picker flow?
I'm trying to fix a legacy app (hasn't been updated to iOS7 or above. Still shows iOS6 UI). Whenever the app tries to open, it crashes. I found the problem at the didFinishLaunchingWithOptions method when I set the tab bar controller.
[self.window setRootViewController:self.tabBarController];
I get this error:
CRASH: *** -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array
This is the Stack Trace:
2014-09-27 01:08:35.517 AppName[2919:1348769] Stack Trace: (
0 CoreFoundation 0x233dde57 <redacted> + 150
1 libobjc.A.dylib 0x30a8bc8b objc_exception_throw + 38
2 CoreFoundation 0x232f2e9d CFRunLoopRemoveTimer + 0
3 AppName 0x000940eb -[NSArray(UtilityExtensions) firstObject] + 46
4 UIKit 0x2694a93d <redacted> + 400
5 UIKit 0x269b869f <redacted> + 254
6 AppName 0x00137fa3 -[FirstChildViewController viewWillAppear:] + 126
So I understand that bug to be something where its assumed I'm trying to access an item in an array where none exists. But the tab controller shows a count of all the view controllers it should have. So Any help would be greatly appreciated.
Again, this ONLY happens when I try to build and run for iOS8.
Thanks in advance!
So I am at my wit's end on this, I am toggling some sharedprefs back and forth, and eventually it makes my app crash. I thought it was because I wasn't deallocating observers properly, but upon looking at the crash log it says that an unrecognized selector is sent to instance. Does anybody know more about crash logs that can tell me more about what's happening? I can get the basic gist of what's happening out of the log, but I'm still a rookie and a lot of the information is going over my head.
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType _adjustLengthDueToViewFrameChange:]: unrecognized selector sent to instance 0x608000095b80'
terminating with uncaught exception of type NSException
abort() called
Application Specific Backtrace 1:
0 CoreFoundation 0x00007fff8fdcb25c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff92afae75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8fdce12d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff8fd29272 ___forwarding___ + 1010
4 CoreFoundation 0x00007fff8fd28df8 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x00007fff8fd99e0c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
6 CoreFoundation 0x00007fff8fc8d82d _CFXNotificationPost + 2893
7 AppKit 0x00007fff915a4003 -[NSView _postFrameChangeNotification] + 434
8 AppKit 0x00007fff915ad6c2 -[NSView setFrameSize:] + 1586
9 AppKit 0x00007fff915ad049 -[NSView setFrame:] + 294
10 AppKit 0x00007fff915acc2b -[NSWindow setContentView:] + 453
11 AppKit 0x00007fff91beeace -[NSStatusItem setView:] + 224
12 MyAppHelper 0x00000001000775f5 -[NSStatusItem(BCStatusItem) setupView] + 85
13 MyAppHelper 0x000000010000cdbb -[MyAppHelperCapHelperServer createStatusBarItem] + 299
14 MyAppHelper 0x000000010000cf5b -[MyAppHelperCapHelperServer insertCaptureMenu] + 43
15 MyAppHelper 0x000000010000fe3d -[MyAppHelperHelperServer observeValueForKeyPath:ofObject:change:context:] + 733
16 Foundation 0x00007fff927e8f28 NSKeyValueNotifyObserver + 387
17 Foundation 0x00007fff927e80f8 NSKeyValueDidChange + 453
18 Foundation 0x00007fff927ecbe6 -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] + 118
19 MyAppHelperHelper 0x0000000100109a3d __57-[RMSharedUserDefaults __applyBaselineAndNotify:updates:]_block_invoke + 349
20 CoreFoundation 0x00007fff8fd086df __65-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 111
21 CoreFoundation 0x00007fff8fd085ee -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 222
Primarily, I have no idea what it means in the exception information: [__NSCFType _adjustLengthDueToViewFrameChange:]. I cannot seem to find any information anywhere.
Thanks in advance!
First, I assume you are manually managing the memory, if so, I'll Highly recommend you to migrate to ARC (Automatic Reference Counting) it will manage the memory for you and you wont have this type or errors anymore. There are plenty of tutorials on Google of how to do this.
You can read more here: Transitioning to ARC Release Notes
Second, without ARC, this kind of error is often caused because you are calling a method/selector on an already released object, that's why the method/selector is not recognized.
This assuming you take care of clearing all the warnings on your project, if not, first go and check if there isn't a warning already pointing that you are trying to call a method/selector that doesn't exist for some object in your app. You can use the Analyze option as mentioned on the comments of this answer. To do that just Cmd+Shift+b, select the Analyze option from the Product Menu or Press and Hold the "Play" button you use to build the app and you will see the Analyze option as well.
Finally, I see you are using User Defaults. I'll recommend making sure you are retaining the values you are receiving from the User Defaults as they came with autorelease. This will explain why the compiler is not able to show the exact line of code where this error is happening, because it happens until the objet is autoreleased.
If is not the User Defaults I'll go and check all my autoreleased variables, is most likely that the problem is with one of them.
Our Mac cocos2d app (http://deepworldgame.com) has been randomly throwing "TSMProcessRawKeyCode failed" exceptions for some time now, and I'm wondering if anyone has experienced this error or knows how to prevent it.
It always happens via the [NSEvent charactersIgnoringModifiers] call within ccKeysDown or ccKeysUp (it also happens for [NSEvent characters] without the modifiers). I don't think it's related to specific keys. Sometimes it only happens one time and the app continues to function afterward (if the exception is caught), but other times it essentially locks up keyboard input indefinitely and continues to cause exceptions with all future keypresses (again, when these exceptions are caught).
I've found little on the internets regarding this issue, unfortunately. One place I did find was in the Adium source code (https://bitbucket.org/adium/adium/src/6d1f9b903525/Source/AIExceptionController.m), which catches this exception with the comments:
//Ignore various known harmless or unavoidable exceptions (From the system or system hacks)
...
// [TSMProcessRawKeyCode] May be raised by -[NSEvent charactersIgnoringModifiers]
It is indeed harmless when thrown once, but when the occasion happens that it continuously fires, it's a real problem - especially when you're in fullscreen mode and can't use cmd-F to escape!
So, if anyone has any thoughts or experience, I would be HIGHLY grateful. This is pretty much the one remaining superbug in our application, and I would love to squash it into dust.
Thanks!
Here is the typical stack trace (MacManager.m is our object which implements the cocos2d keyboard delegate protocol):
Crashed Thread: 7 CVDisplayLink
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Application Specific Information:
objc[28871]: garbage collection is OFF
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'TSMProcessRawKeyCode failed (-192)'
*** Call stack at first throw:
(
0 CoreFoundation 0x95b27d87 __raiseError + 231
1 libobjc.A.dylib 0x9315a149 objc_exception_throw + 155
2 CoreFoundation 0x95a8f619 +[NSException raise:format:arguments:] + 137
3 CoreFoundation 0x95a8f589 +[NSException raise:format:] + 57
4 AppKit 0x9ac01c1f _convertEventRefToString + 300
5 AppKit 0x9ab23b5e -[NSEvent charactersIgnoringModifiers] + 880
6 Deepworld 0x0001fd8a -[MacManager ccKeyDown:] + 65
7 CoreFoundation 0x95a7d091 -[NSObject performSelector:withObject:] + 65
8 Deepworld 0x0006bc95 -[CCEventDispatcher keyDown:] + 80
9 CoreFoundation 0x95a7d091 -[NSObject performSelector:withObject:] + 65
10 Deepworld 0x0006c014 -[CCEventDispatcher dispatchQueuedEvents] + 143
11 Deepworld 0x0006a9a4 -[CCDirectorDisplayLink getFrameForTime:] + 155
12 Deepworld 0x0006aaf1 MyDisplayLinkCallback + 40
13 CoreVideo 0x9b44a5e1 _ZN13CVDisplayLink9performIOEP11CVTimeStamp + 489
14 CoreVideo 0x9b4494e4 _ZN13CVDisplayLink11runIOThreadEv + 876
15 CoreVideo 0x9b449161 _ZL13startIOThreadPv + 160
16 libsystem_c.dylib 0x968a4ed9 _pthread_start + 335
17 libsystem_c.dylib 0x968a86de thread_start + 34
)
I don't think sending events in general is thread-safe, not to mention from a thread that has been created not within +[NSThread detachNewThreadSelector:toTarget:withObject:] (a thread created using the Objective-C run-time has __NSThread__main__ in the backtrace).
I guess your app is the Deepworld binary part - when dispatching events, try using -[NSObject performSelectorOnMainThread:waitUntilDone:] instead, dispatching the events on the main thread.