Re: NSAppleScript returning wrong error info
Re: NSAppleScript returning wrong error info
- Subject: Re: NSAppleScript returning wrong error info
- From: Jean-Daniel Dupas <email@hidden>
- Date: Tue, 18 Mar 2008 11:20:37 +0100
Le 18 mars 08 à 10:47, Vinay Prabhu a écrit :
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.
But strangely, on return, 'errorInfo' is not pointing to object of
NSDictionary, instead it is
pointing to '_NSRepresentationInfo' object.
I have used the following code to find the class of 'errorInfo',
Class temp = [errorInfo class];
NSLog(@"%@", temp);
I can see the class type as _NSRepresentationInfo in console, on
running the code.
Because of this, my application crashes, when I use NSDictionary
API's like objectForKey, count etc on errorInfo.
The crash log shows,
[_NSRepresentationInfo count] selector not recognized
This happens when I run my application in Japanese language.
Any idea, why NSAppleScript is not returning NSDictionary object,
when error occurs?
Any help is greatly appreciated.
Thanks and Regards
-Vinay
Are you sure an error occured? Try to initialize your error to nil
before creating your script. I think initWithContentsOfURL: error: do
not touch your errorInfo object and as it is not initialized, is point
to a random memory adress that contains an _NSRepresentationInfo.
_______________________________________________
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