Xcode quit unexpectedly in interface builder - crash

I started a new project in Xcode (Cocoa App OSX, Objective-C). Every time I try to add a button to a window in Interface Builder(drag and drop) I receive the following error and Xcode quits.
"UNCAUGHT EXCEPTION (NSUnknownKeyException): [ valueForUndefinedKey:]: this class is not key value coding-compliant for the key springLoaded."
Xcode Version 6.3 (6D570) on Yosemite 10.10.3
Anyone experienced such behavior?
part of the crash:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Application Specific Information:
ProductBuildVersion: 6D570
UNCAUGHT EXCEPTION (NSUnknownKeyException): [<NSButton 0x7fb46e18f090> valueForUndefinedKey:]: this class is not key value coding-compliant for the key springLoaded.
UserInfo: {
NSTargetObjectUserInfoKey = "<NSButton: 0x7fb46e18f090>";
NSUnknownUserInfoKey = springLoaded;
}
Hints: None
Backtrace:
0 0x00007fff90a4c4f4 __exceptionPreprocess (in CoreFoundation)
1 0x00000001050ee184 DVTFailureHintExceptionPreprocessor (in DVTFoundation)
2 0x00007fff90d1976e objc_exception_throw (in libobjc.A.dylib)
3 0x00007fff90a4c0a9 -[NSException raise] (in CoreFoundation)
4 0x00007fff8dc77d25 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] (in Foundation)
5 0x00007fff8db4cccb -[NSObject(NSKeyValueCoding) valueForKey:] (in Foundation)
Update:
Xcode now somehow survived the button add but when I try to save I get this Alert:
Unfortunately this happens with Xcode 6.3.1

Finally I got an answer from apple devforums.
The reason for this is that I use OSX seed build OS X 10.10.3 (14D87h).
This is new API related to Force Touch trackpads. It was added in OS X
10.10.3, but only in seed builds

Related

Xcode 6.3.1 crashes when opening existing project

I updated Xcode to the latest version via the App Store, as it normal.
I am unable to open any existing project.
I have deleted all Derived Data and have restarted my laptop. Still crashing. And, I have no 3rd party plug ins.
I am including most of the dump. Didn't include the binary images data.
It appears that it might be related to the interface builder. The one app that I want to open, has the Storyboard as the foremost tab.
Thanks for any help in solving this.
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Application Specific Information:
ProductBuildVersion: 6D1002
ASSERTION FAILURE in /SourceCache/IDEInterfaceBuilder/IDEInterfaceBuilder-7702/Foundation/Utilities/IBFoundationAdditions.m:3148
Details: No object for "NSFont" key.
Object: <NSDictionary>
Method: +ib_strictDictionaryWithKeysAndObjects:
Thread: <NSThread: 0x7ffa00c39650>{number = 1, name = main}
Hints: None
Backtrace:
0 0x000000010520cbfa -[IDEAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:message Format:arguments:] (in IDEKit)
1 0x0000000103f6ab9f _DVTAssertionHandler (in DVTFoundation)
2 0x0000000103f6ae8e _DVTAssertionFailureHandler (in DVTFoundation)
3 0x000000010b307ab6 +[NSDictionary(IBDictionaryAdditions) ib_strictDictionaryWithKeysAndObjects:] (in IBFoundation)
4 0x000000010fb0e22f IBTextAttributesWithFontColorShadowAndAlignment (in IDEInterfaceBuilderKit)
5 0x000000010fb0e000 __48+[IBViewControllerPlaceholderStyle defaultStyle]_block_invoke (in IDEInterfaceBuilderKit)
6 0x00007fff8d1adc13 _dispatch_client_callout (in libdispatch.dylib)
7 0x00007fff8d1adb26 dispatch_once_f (in libdispatch.dylib)
8 0x000000010fb0dd8e +[IBViewControllerPlaceholderStyle defaultStyle] (in IDEInterfaceBuilderKit)
9 0x000000010fb0e458 IBDrawViewPlaceholder (in IDEInterfaceBuilderKit)
10 0x00000001141e23f9 (in IDEInterfaceBuilderCocoaTouchIntegration)
I fixed this by fixing another issue. OS X app store kept crashing on installation of 10.10. Solved it by downloading 10.10 from Apple directly.
Then, the issue with Xcode just simply went away! And, now app store app works right. Must have been some corruption in the app store itself.

Can't figure out "Unrecognized selector sent to instance" source

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.

where to look for a bug. document, app delegate or both?

following situation: i have a document based App. by default when i open the app it displays just the menu on top of the screen. then i hit file->new and it opens up a brand new document.xib interface. working fine on my main pc. but on my secodnary pc running 10.6.8 the app crashes as soon as i run it. (code is compiled with the proper target...)
this application is crashing BEFORE i even see the main menu at the top. could the cause of the crash still be inside the document's xib file? or will it most likely be in the code that is outside the document part? what i mean is: is the code checked completely at the application lounch or does it onyl cause a crash when it reaches the code that is causing it?
thanks
edit
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 ??? 000000000000000000 0 + 0
1 com.apple.AppKit 0x0000000100def22e -[NSCustomObject nibInstantiate] + 416
2 com.apple.AppKit 0x0000000100def01b -[NSIBObjectData instantiateObject:] + 259
3 com.apple.AppKit 0x0000000100dee406 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 336
4 com.apple.AppKit 0x0000000100deca91 loadNib + 226
5 com.apple.AppKit 0x0000000100debfa1 +[NSBundle(NSNibLoading)_loadNibFile:nameTable:withZone:ownerBundle:] + 248
6 com.apple.AppKit 0x0000000100debdd9 +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 326
7 com.apple.AppKit 0x0000000100de935b NSApplicationMain + 279
8 mad-sharky.com.Stockuploader 0x0000000100001194 0x100000000 + 4500
The problem lies not in the XIB file, but rather in one of the objects in said file that is being instantiated incorrectly. Something about the object is causing it's -initWithCoder: method to fail. It appears you're probably not calling through to super in said method, and are simply returning self, which is not allowed.
The other possibility is that you have a "ghost outlet". Sometimes, when an IBOutlet is created and linked, then the piece of code that declares it is removed, IB doesn't de-link the outlet, and NSCoder tries to dearchive a nil outlet.
found the problem. here it is:
now it works without any problems!

CorePlot MonoMac bindings crashing

I am trying to use the CorePlot 0.9 binding for monomac, but that seems to be a hard task. The monotouch sample builds and runs without any problems, but I don't need that one.
Since only a CorePlotiOS.dll was present in the binding, I had to build one for osx myself, but first of af all, no bmake.exe was present, so I had to download the monomac source and build it myself first. Then I tried to build the CorePlotOSX.dll but that caused some compilation problems. Looking at the build-script for mono touch I tried with this line instead:
MONO_PATH=$(MONOMAC)/src mono $(MONOMAC)/src/bmac.exe -e -unsafe coreplot.cs -s=enums.cs -x=extras.cs -x=AssemblyInfo.cs --sourceonly=list --tmpdir=osx -r:System.Drawing -r:MonoMac -lib:$(MONOMAC)/src -baselib:$(MONOMAC)/src/MonoMac.dll .
Anything wrong there?
I have reduced the problem to this:
graph = new CPTPieChart();
graph.Title = "Test";
The allocation seems to survive, but whenever I try to access the object, I crash:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000bf887fac
VM Regions Near 0xbf887fac:
Stack 00000000b038d000-00000000b040e000 [ 516K] rw-/rwx SM=COW
--> Stack 00000000bc088000-00000000bf888000 [ 56.0M] ---/rwx SM=NUL
Stack 00000000bf888000-00000000c0088000 [ 8192K] rw-/rwx SM=COW
Application Specific Information:
objc[17645]: garbage collection is OFF
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.CoreFoundation 0x97c8aebc __CFStringEncodeByteStream + 12
1 com.apple.Foundation 0x9ac8ed49 -[NSString(NSStringOtherEncodings) getBytes:maxLength:usedLength:encoding:options:range:remainingRange:] + 263
2 com.apple.Foundation 0x9ac8e8ee bytesInEncoding + 213
3 com.apple.Foundation 0x9ac8e814 -[NSString(NSStringOtherEncodings) UTF8String] + 42
4 com.apple.CoreFoundation 0x97ce478c -[__NSCFString UTF8String] + 204
5 ??? 0x00f91208 0 + 16323080
6 ??? 0x030d708c 0 + 51212428
7 ??? 0x030d703c 0 + 51212348
8 ??? 0x016877d4 0 + 23623636
Any ideas? Running Mac OSX 10.7.5 btw.
Ok, that was hard. After several days of fighting xcode and monomac, it turned out, that the native CorePlot framework (dynamic lib) was not loaded. I was not aware, that I was supposed to load it myself (I am a monomac newbie, sorry...but isn't it rather ugly it fails silently in that way??)
Two ways to do this: either
Dlfcn.dlopen ("CorePlot.framework/CorePlot", 2); // 2 = load now, 0 = lazy load
or [assembly:MonoMac.RequiredFramework("CorePlot.framework/CorePlot")]

Aperture Plug-in crashes with EXC_BAD_ACCESS

I try to run the SampleFTPExportPlugIn that comes with the Aperture SDK 2.1. I had to tweak the Base SDK setting and manually copy the PluginManager.Framework folder to /Library/Frameworks, as described here.
All compiles and Aperture 3.2.3 now offers the menu item File/Export/FTP.
When selecting the "FTP" export method and thus triggering the plug-in code, Aperture crashes with a EXC_BAD_ACCESS. The illegal memory access happens in the initWithAPIManager method of class SampleFTPExportPlugIn when trying to get a reference to the ApertureExportManager:
_exportManager = [[_apiManager apiForProtocol:#protocol(ApertureExportManager)] retain];
This is the second line that gets executed after Aperture hands over control to the plug-in and seems to be the standard way of getting a reference to the ApertureExportManager in any Aperture plug-in (I haven't found any alternative ways of achieving the same anywhere).
Here the stacktrace:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: 0x000000000000000d, 0x0000000000000000
VM Regions Near 0:
-->
__TEXT 0000000100000000-0000000100798000 [ 7776K] r-x/rwx SM=COW /Applications/Aperture.app/Contents/MacOS/Aperture
Application Specific Information:
objc_msgSend() selector name: class
objc[3000]: garbage collection is OFF
Performing #selector(a_exportPlugIn:) from sender NSMenuItem 0x111d2a540
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x00007fff8711c090 objc_msgSend_vtable2 + 16
1 com.apple.CoreFoundation 0x00007fff8381e25f -[__NSCFString isEqualToString:] + 63
2 com.apple.PluginManager 0x0000000101211218 -[PROBundleHandler apiForProtocol:] + 109
3 com.apple.CoreFoundation 0x00007fff83852f4c __invoking___ + 140
4 com.apple.CoreFoundation 0x00007fff83852de4 -[NSInvocation invoke] + 132
5 com.apple.CoreFoundation 0x00007fff83852fb4 -[NSInvocation invokeWithTarget:] + 52
6 com.apple.CoreFoundation 0x00007fff8384dff4 ___forwarding___ + 756
7 com.apple.CoreFoundation 0x00007fff8384dc88 _CF_forwarding_prep_0 + 232
8 com.apple.SampleFTPExportPlugIn 0x000000012c0d5361 -[SampleFTPExportPlugIn initWithAPIManager:] + 209
9 com.apple.PluginManager 0x000000010120c6fa -[PROConcretePlugIn plugInInstance] + 212
I read all about Objective-C memory management but cannot make sense of it. All the other examples I found on the web are implemented just like that so I guess I have a compatibility problem, something missing in my Aperture / Library installation. How can I narrow down the problem?
EDIT:
The problem seems to be with the passed in apiManager. The method signature is:
- (id)initWithAPIManager:(id<PROAPIAccessing>)apiManager
The parameter is then assigned to our internal reference:
_apiManager = apiManager;
However the actual class passed in is PROPlugInFirewall, as this output reviels:
NSLog(#"_apiManager class is: %#", [[_apiManager class] description]);
Then calling the respondsToSelector leads to the same crash although this method is inherited from NSObject.
if ( [_apiManager respondsToSelector:#selector(apiForProtocol:)] ) {
NSLog(#"responds");
}
The _apiManager itself describes itself as:
_apiManager is: <[*<PROBundleHandler: 0x14d79130> (PROAPIAccessing)*]>
Still stuck...
EDIT:
So it looks like Aperture is passing in a pointer that points to nirvana... However, I just installed another plugin, from the Apple webpage, with installer and everything. That one failed too when invoked...
Download FXPlug 1.2.5 SDK
Open the contents of the installer package
Copy PluginManager.framework to /Library/Frameworks
Your plugin should work now!
The newer versions of PluginManager.framework in FXPlug SDK(2.2/2.4) will cause this crash.
Tested on 10.8 with Xcode 4.5
I found that Justin's answer above didn't work for me when needing to build for Aperture 3.4, as it requires x86_64 architecture which the FXPlug 1.x versions don't support.
After trying various versions of the PluginManager framework, I found that the version available here doesn't cause the above crash and also contains the valid 64-bit architecture. Just replace the contents of /Library/Frameworks/PluginManager.framework/Versions/B with the contents of the linked archive and you're good to go.