Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 18, 2012, 03:25 PM   #1
Bunkum
macrumors newbie
 
Join Date: Jun 2010
WebScriptObject "life of a" script problem

So I've run into a little problem and I'm not sure if I'm doing something wrong or if it's actually designed like this, and so I'm not using it how it was meant to be used.

When I evaluate a script or add global functions/function callbacks (and they are set with kJSPropertyAttributeDontDelete and kJSPropertyAttributeReadOnly), and then wish to make use of it repeatedly later using callWebScriptMethod:withArguments: it only seems to last for certain number of calls before they (I assume) get freed. Now if I call a global function callback they stay around for a quite a bit longer but still eventually get freed.

Now a number of the WebScriptObject's private method still report as if it was working properly, it's only when it tries to execute it, it returns undefined and the actions in the script are not performed (reason I think it's getting freed).

So is there a way/something I'm missing in order to get the scripts and functions to last for the life of the WebScriptObject?


EDIT: Actually I realized it is because I'm not setting the evaluated scripts as kJSPropertyAttributeDontDelete, since the global functions and callbacks I used and did set with it still function. However I don't know how I'm meant to go about setting the properties of the evaluated scripts.


EDIT: I've got one way I can go about it but it doesn't seem like the correct solution. Get all the properties for that WebScriptObject object. But the problem with this is it obviously has all the properties (don't want to modify all of them), I only want the properties from the script that was evaluated.

Last edited by Bunkum; Mar 19, 2012 at 05:20 AM.
Bunkum is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Run Script with Administrative Privileges during PackageMaker Installation rebello95 Mac Programming 0 Nov 7, 2011 11:27 PM
"Kind of a" MBA related use question... Ravenwolf40 MacBook Air 2 Mar 30, 2011 08:05 PM
File upload script problem on OS X server moron Mac Programming 1 Jun 7, 2006 03:48 PM
AppleScript GUI scripting problem. mduser63 Mac Programming 2 Oct 14, 2005 09:29 AM
iphoto 5 script problem derajfast Mac Applications and Mac App Store 0 Aug 20, 2005 02:57 PM


All times are GMT -5. The time now is 09:19 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC