Simple Out-of-Box Demo: Private Framework Crashes in 10.3.9
Simple Out-of-Box Demo: Private Framework Crashes in 10.3.9
- Subject: Simple Out-of-Box Demo: Private Framework Crashes in 10.3.9
- From: Jerry Krinock <email@hidden>
- Date: Fri, 21 Mar 2008 15:16:56 -0700
I have created a demo app and private framework, in separate
projects. Running in 10.3.9, when the framework sends a message to a
Cocoa object, the app crashes. Works fine in 10.4 and 10.5.
The framework adds a category with a single method onto NSString, as
shown. Code, Project Settings, links to Build Transcripts and
projects, Console and Crash Log snippets are all given below.
I've been going nuts on this for 3 days. Make my weekend by pointing
out the problem in 3 seconds. Thanks!
Jerry
*********** NSString+Crash.m in TestFrame project ***********
#import "NSString+Crash.h"
@implementation NSString (Crash)
+ (void)crashMe {
NSLog(@"checkpoint 1") ;
// The next line causes a crash!
NSDictionary* dic = [NSDictionary dictionaryWithObject:@"Jerry"
forKey:@"name"] ;
NSLog(@"checkpoint 2") ;
NSString* name = [dic objectForKey:@"name"] ;
NSLog(@"name is: %@", name) ;
}
@end
*********** TestAppDelegate.m in TestApp project *********************
#import "TestAppDelegate.h"
#import "TestFrame/NSString+Crash.h"
@implementation TestAppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNote {
[NSString crashMe] ;
NSLog(@"Test complete. Will quit.") ;
[NSApp terminate:self] ;
}
@end
*********** Project Settings, etc. *********************************
I started with "New Project" for both app and framework in Xcode 3.0.
In Framework project, Linked Frameworks,
turned off Cocoa (because it umbrellas CoreData -> crash in 10.3.9)
turned on CoreFoundation and AppKit (to replace "Cocoa")
In both the app and the framework Build Settings:
Base SDK Path = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk
Added per-architecture Build Setting:
Mac OS X Deployment Target
Intel Mac OS X 10.4
PowerPC Mac OS X 10.3
In GCC Compiler Settings,
Accelerated Objective-C Dispatch = OFF
Xcode 3.0 Build Transcripts:
http://sheepsystems.com/engineering/Crash/FrameworkBuildTranscript.txt
http://sheepsystems.com/engineering/Crash/AppBuildTranscript.txt
Demo App and Framework Xcode Projects:
http://sheepsystems.com/engineering/Crash/TestProjects.zip
*********** Console Log ********************************************
2008-03-21 13:21:53.696 TestApp[3695] checkpoint 1
Mar 21 13:21:59 Newhall crashdump: Started writing crash report to: /
Users/bh/Library/Logs/CrashReporter/TestApp.crash.log
Mar 21 13:22:02 Newhall crashdump: Finished writing crash report to: /
Users/bh/Library/Logs/CrashReporter/TestApp.crash.log
*********** Crash Report ********************************************
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000020
Thread 0 Crashed:
0 libobjc.A.dylib 0x908611ec objc_msgSend + 0xc
1 com.apple.Foundation 0x90a2c488 -[NSPlaceholderDictionary
initWithObjects:forKeys:count:] + 0xb8
2 com.apple.Foundation 0x90a63710 +[NSDictionary
dictionaryWithObject:forKey:] + 0x44
3 com.sheepsystems.TestFrame 0x00010ed8 0x10000 + 0xed8
4 com.yourcompany.TestApp 0x00002d84 -[TestAppDelegate
applicationDidFinishLaunching:] + 0x28
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden