Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing Arrays Between Widget and Plugin



Ok. let's start over. I've made a modified version of the "Fortune"
example widget that exhibits the same crash:
    http://homepage.mac.com/mrakes/.Public/ModFortune.zip
and compare to:
    <path to your developer stuff>/Developer/Examples/Dashboard/...

Instead of returning a string at a time to javascript, I attempted
to return an NSArray, and then display one of the strings in the array.
My getFortuneArray method is called (the NSLog() comes out), but then
the widget crashes.

any help is greatly appreciated...

-mark




On May 10, 2005, at 10:25 PM, Tom Bunch wrote:
Yes. I suppose your NSArray is the result of a objC call? Supposing you've figured out how to call it already from javascript (see these methods)

+ (NSString *)webScriptNameForSelector:(SEL)aSel;
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSel;

you can do something like this:

var things = MyWidgetPlugin.someThings();
if (things) {
var thingCount = things.length;
for (var thingIndex = 0; thingIndex < thingCount; ++ thingIndex) {
var aThing = things[ thingIndex];
}


Does that help? Your plugin class just has an instance method like:

- (NSArray *)someThings;

-Tom



On May 10, 2005, at 1:19 PM, Stefan Hanshans wrote:



Is it possible to obtain an array (NSArray) from a widget plugin in JavaScript?

TIA

Stefan






_______________________________________________ Do not post admin requests to the list. They will be ignored. Dashboard-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Dashboard-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden
References: 
 >Passing Arrays Between Widget and Plugin (From: Stefan Hanshans <email@hidden>)
 >Re: Passing Arrays Between Widget and Plugin (From: Tom Bunch <email@hidden>)
 >Re: Passing Arrays Between Widget and Plugin (From: Mark Rakes <email@hidden>)
 >Re: Passing Arrays Between Widget and Plugin (From: Tom Bunch <email@hidden>)
 >Re: Passing Arrays Between Widget and Plugin (From: Mark Rakes <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.