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

Similar Threads
thread Thread Starter Forum Replies Last Post
"Date modified" script strange behavior in Mavericks Remcokw Mac Programming 7 Mar 12, 2014 04:40 PM
Script to prevent Macbook with "Replace Soon" battery from crashing spt MacBook Pro 0 Jun 13, 2013 02:03 PM
Is this battery life for my iPhone 5 considered "good" or "average?" Mr. RPG iPhone 25 May 26, 2013 05:45 PM
"Potentially useful" Abbyy Fine Reader script. (does not replace input file) tiriya Mac Programming 0 Aug 9, 2012 08:19 AM
iTunes Apple script for additional "View Options"? kumquat Apple TV and Home Theater 14 Jun 29, 2012 09:02 AM

Forum Jump

All times are GMT -5. The time now is 01:13 AM.

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

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