what is a signal 5 (SIGTRAP) when its at home.

i encountered this problem in xcode,
basicly any project i try to build and run seems to quit as soon as it opens.

the last project i was working on was experimenting with user defaults.
my suspision is that i deleted every user default, although i thought the user defaults were only relavent to the current project.

this is the log i get when i try to run the app. although its the same with any app.

[Session started at 2006-01-05 12:44:26 +0000.]
2006-01-05 12:44:26.607 daff[624] *** -[NSCFArray _getCString:maxLength:encoding:]: selector not recognized [self = 0x3148c0]
2006-01-05 12:44:26.609 daff[624] *** Uncaught exception: *** -[NSCFArray _getCString:maxLength:encoding:]: selector not recognized [self = 0x3148c0]

daff has exited due to signal 5 (SIGTRAP).

–can any one enlighten me as to whats happening.
many thanks

Hmm… rather strange…

The problem that the log shows is that your App tries to call the ObjC method “getCString:maxLength:encoding:” - this is perfectly legal, as this is a method of Cocoa’s NSString class.

So, first of all let’s check whether the neccessary files are there. Please open your project in XCode. In the “Groups & Files” area, there should be a directory “Frameworks” which should contain two subdirs “Linked Frameworks” - containing “Cocoa.framework” and “AppleScriptKit.framework” - and “Other Frameworks” - containing “AppKit.framework” and “Foundation.framework”. Is this the case?

If so, Ctrl-Click (or right-click) each of the .framework items and say “Open with Finder” - does this work?

Let me know and then we’ll see what we can do…

EDIT: I just saw that the method in question has only been added in MacOS 10.4 - are you using some newer XCode version with a 10.3.x MacOS X? Or perhaps the other way round?


hi daniel,
thanks for your reply.
i have tryed opening the .framework files using right click and they do exist.

i have just notest that if i open any of the example projects, they seem to run ok, but if i open any of my existing projects or create a new project i get this error log.

i am currently using xcode 2.1 on os x 10.4.3.

could the problem be anything to do with user defaults?. if so would this effect projects globally?

many thanks,

Hmm… it’s becoming more difficult now, as I’m still under MacOS 10.3.9 (and therefore don’t use XCode 2.x). However, if the user settings were deleted, XCode ought to use default settings, and these should work, shouldn’t they?

Anyone else got any ideas?!

Model: iBook g3/800 14"
Browser: Safari 312.3.3
Operating System: Mac OS X (10.3.9)

Without getting too detailed about the inner workings of ASS, here’s my opinion. ASS is merely a set of protocols that allow you to use applescript… a more plain-english language… to act as an interpreter for the underlying obj-c code that ultimately is being executed when your app runs. Somewhere in your code, you’re executing an ASS command that once compiled actually executes the obj-c methods that you’re having a problem with. For example, something simple that you might write as “set someString to (someList as string)” in applescript, is eventually translated into something less friendly like the core function “_getCString:maxLength:encoding:”. Obviously, some coercion or assignment you’re trying to make is not working out for you. Unfortunately, the error itself tells us nothing, because it is likely a very common method that is being called, and we have no way of troubleshooting your code without seeing it.

You mention that “basicly any project i try to build and run seems to quit as soon as it opens.” Does this mean that EVERY project you create does this… or that every project that you create that tries to execute this same problem code crashes? Can you make a simple ‘hello world’ app and get that to work, without doing anything fancy? It seems to me that you’re likely getting something wrong in your code that’s not passing valid data around. It also seems to me that it’s probably not the user defaults directly that is the problem. Perhaps the way you’re referencing them is wrong, or the data you’re passing to the handler is wrong, or it could be something totally unrelated. There are way too many “what if’s” for anyone to tell for any certainty what the problem is from just the error returned. You’ll either need to narrow it down to one section of code that is the problem, or send me the whole project and I can take a look and see if I can find the trouble.


hi jobu,
thanks for the reply,
yes it is every project i create, even if i havent input any code, and every applescript is unconnected to interface builder, but all of the example projects work fine,

this is the code was using before every thing went pair shaped, although i may have carried on editing before realizing it was effecting more than just this project, also i appologise if for the noobiness of the code as i am still new to ass and this script is still very much work in progress.

property defaultname : ""
property defaultinfo : ""
property defaultlist : ""

on clicked theObject
	if name of theObject is "go" then
	end if
	if name of theObject is "add" then
		set defaultname to contents of text field 1 of window "main"
		set defaultinfo to contents of text field 2 of window "main"
		get_data(defaultname, defaultinfo)
		set_default_info(defaultname, defaultinfo)
		tell window "main"
			make new menu item at the end of menu items of menu of popup button "pop" with properties {name:defaultname, title:defaultname, enabled:true}
		end tell
		set defaultlist to title of every menu item of popup button "pop" of window "main" as list
		log defaultlist
		make new default entry at end of default entries of user defaults with properties {name:"defaultlist", contents:defaultlist}
	end if
	if name of theObject is "remove" then
		set temp to title of current menu item of popup button "pop" of window "main" as string
		log temp
		delete current menu item of popup button "pop" of window "main"
		delete (every default entry of user defaults whose name is temp)
	end if
end clicked

on action theObject
	(*Add your script here.*)
end action

on awake from nib theObject
	set defaultlist to contents of default entry "defaultlist" of user defaults
	log defaultlist
	tell window "main"
		delete every menu item of menu of popup button "pop"
		repeat with tmpItem in defaultlist as list
			make new menu item at the end of menu items of menu of popup button "pop" with properties {name:tmpItem, title:tmpItem, enabled:true}
		end repeat
	end tell
end awake from nib

on will close theObject
end will close

on get_data(a, b)
	log "$" & a & b
end get_data

on set_default_info(a, b)
	set a to a as string
	tell user defaults
		if not (exists default entry a) then
			make new default entry at end of default entries with properties {name:a, contents:b}
		end if
	end tell
end set_default_info

unfortunatly i have to go to work now but i’ll get back tonight if i have any developements
cheers truth.

i worked it out.
all my application’s info.plist’s reference the com.apple.ASApplication.plist on built as where the example applications reference there own com.apple.AppleScriptStudioExamples.DisplayPane.plist. i checked out the ASApplication.plist and it was a mess. so i tried removing the plist and everything is back to normal.

i think I’m gona have to be more careful with my user defaults, and stop scripting late at night!!

anyway, thanks to everyone for your help and support,
C ya round!