|Mar 18, 2012, 04:25 PM||#1|
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 06:20 AM.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|"Date modified" script strange behavior in Mavericks||Remcokw||Mac Programming||7||Mar 12, 2014 05:40 PM|
|Script to prevent Macbook with "Replace Soon" battery from crashing||spt||MacBook Pro||0||Jun 13, 2013 03:03 PM|
|Is this battery life for my iPhone 5 considered "good" or "average?"||Mr. RPG||iPhone||25||May 26, 2013 06:45 PM|
|"Potentially useful" Abbyy Fine Reader script. (does not replace input file)||tiriya||Mac Programming||0||Aug 9, 2012 09:19 AM|
|iTunes Apple script for additional "View Options"?||kumquat||Apple TV and Home Theater||14||Jun 29, 2012 10:02 AM|
All times are GMT -5. The time now is 02:38 AM.