Initializing the errorInfo to nil did the trick.

When no error occurs, NSAppleScript will not touch the error dictionary.
So I was trying to access the dictionary pointing to junk memory.

Thanks for the help.
-Vinay

On Mar 18, 2008, at 7:44 PM, Nir Soffer wrote:


On Mar 18, 2008, at 11:47, Vinay Prabhu wrote:

I am trying to create a NSAppleScript object using a applescript file.
The code is as follows,

NSDictionary* errorInfo;
NSAppleScript *script = [[NSAppleScriptalloc] initWithContentsOfURL: scriptURL error: &errorInfo];

As per the documentation, on return 'errorInfo' should point to a dictionary containing error messages.

No, the docs say:

"On return, if an error occurs, a pointer to an error information dictionary."

If an no error occurs, the value is undefined. Check for errors by testing the return value, not the error dictionary.


Best Regards,

Nir Soffer




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to