AppleScriptObjC_Explored_4.0.1 Save and Open Panel errors

I am working through Shane Stanley’s AppleScriptObjC_Explored_4.0.1 Using Examples: Projects for v4.0
I am on OSX 10.9 and xCode 5.0.1
On Chapter 17 Save and Open Panel the Open and Save project failed to run.
Two yellow Target integrity (non fatal)
and 3 red errors (fatal).
Check dependencies:
Unsupported compiler ‘’ selected for architecture ‘x86_64’
Unable to determine concrete GCC compiler for file /Users/m/Downloads/AppleScriptObjC_Explored_4 zipped/AppleScriptObjC_Explored_4/Projects for v4.0/Chapter 17/Open and Save/Open and Save/main.m of type sourcecode.c.objc.
Unable to determine concrete GCC compiler for file /Users/m/Downloads/AppleScriptObjC_Explored_4 zipped/AppleScriptObjC_Explored_4/Projects for v4.0/Chapter 17/Open and Save/Open and Save/NSOpenSave+MyriadHelpers.m of type sourcecode.c.objc.

I swapped the compiler to default and the deployment target to latest.
It hen ran but the two top buttons failed with these errors:
Modal save:
2013-11-06 01:39:09.133 Open and Save[10964:303] *** -[Open_and_SaveAppDelegate showModalSave:]: Unrecognized function fileURLWithPath_. (error -10000)
Modal Open
2013-11-06 01:39:55.615 Open and Save[10964:303] *** -[Open_and_SaveAppDelegate showModalOpen:]: Unrecognized function fileURLWithPath_. (error -10000)

Last I deleted the user defined settings at the bottom of the Build Settings page. The yellow error disappeared but the errors persisted.

Is there a fix for this?
PS I checked the errata page and the one for 10.9 then I searched this forum but was unable to find an answer.

The first error is very clear, the GCC compiler doesn’t support all functionality in Apple’s programming languages while the Apple’s own compiler does. I recommend only to use the GCC compiler when developing in standard/global programming languages like C or C++.

The second error is probably a error in your code. The most common “Unrecognized function” error that I found through the years is:

  • Object is not created (empty variable)
  • Object is not the right class
  • Required framework is not added to the target

Make sure that is all correct.

Thanks for your answer DJ Bazzie Wazzie,

Unfortunately this is not my code and I have not got enough expertise to write alternative methods.
I was really bringing this to Shane’s attention, in case he had not noticed yet.
I am hoping he can post a fix for this in the errata before releasing the examples for AppleScriptObjC_Explored_5 that he is writing now.

The unsupported compiler error happens because Xcode 5 no longer supports the GCC compiler. I specified the GCC compiler because, when I updated the book, it was needed to work around a bug in Apple’s compiler. That’s no longer needed, so changing compiler is the correct thing to do. I’ll add this to the errata page, thanks.

The yellow “errors” are not actually errors, but warnings. If you remove the user defined setting, which turns on garbage collection, you must also turn on Automatic Reference Counting. And you application will then not run in versions of the OS before 10.8.

As for the “unrecognised function” errors, I’m mystified – I just tried here, and the buttons are working fine. I am getting some log entries with the other buttons that suggest some garbage collection errors that are being corrected, which is not uncommon ( malloc: auto malloc[7290]: attempted to remove unregistered weak referrer 0x10af782e0).

Perhaps you could start with a clean copy, then just change to the default compiler and see what happens.

Hi Shane,

Thank you for your input.
As soon as I can I’ll start a new project and let you know.

I forgot you say to do that in your book when you talk about setting up a new project.
I did that thanks.

I ran the project again and the “Unrecognized function fileURLWithPath_. (error -10000)” persisted on both modal save and modal open buttons. Nothing happens, just the error in the console.

I did not get anything wrong from any of the other buttons.

I tested all other buttons again and I always chose ok or saver open as appropriate.
Choose file name logged:
2013-11-06 16:35:12.522 Open and Save[5422:303] Macintosh HD:Users:m:Desktop:Some name.txt
Modal save using category:
2013-11-06 16:37:45.044 Open and Save[5422:303] Macintosh HD:Users:m:Some name.pdf
Modal open using category:
2013-11-06 16:39:33.944 Open and Save[5422:303] Macintosh HD:Users:m:Desktop:ApplescriptObjC training help:Myriad:AppleScriptObjC_Explored_4:not in book:Fiwi new:fFwi new resources:error in xcode.txt
Modal save validating:
2013-11-06 16:40:31.871 Open and Save[5422:303] Macintosh HD:Users:m:12-45.txt
Save as sheet:
2013-11-06 16:41:04.049 Open and Save[5422:303] Macintosh HD:Users:m:Some name.txt
Open as sheet:
2013-11-06 16:41:26.953 Open and Save[5422:303] Macintosh HD:Users:m:Desktop:first folder to test song transposer:folder with a very long name:third embedded folder:la monferrina not set up.txt

In the Project Navigator panel on the left, control-click on the app delegate and choose Open with External Editor. Compile the script in the editor it opens in. Look for the line:

   set theURL to current application's NSURL's fileURLWithPath_(POSIX path of (path to desktop))

It is possible you have a scripting addition installed that uses the term NSURL, and that would clash with the script. If so, make it |NSURL|'s.

Especially with Mavericks, editing in an external editor will save a lot of grief.

Hi Shane,
Excellent advise!
Changing to |NSURL| worked.
No more errors.

I investigated the scripting addition folders:
The user library one is empty

The Library one contains:

In the System Library one:
Digital Hub Scripting.osax

I opened and searched all of them in AppleScript Editor for NSURL but I could not find it .