C H A P T E R 1 7
Additional System Services
Using Additional System Services
Avoiding Undo-Related "Bad Package" Errors
method saves the current context (
) so that later it can
send the "redo" message (the argument to the methodName parameter of the
method) to the appropriate object. As a result, it is possible that
references to your application can stay in the system inside the Undo mechanism's
data structures after the application has been removed. These references can cause
-10401 (bad package) errors when the user taps Undo after ejecting the card on
which the application resides. Using the
function on all
parameters passed to the
function does not remedy this problem.
You can use the
function to clean up dangling references
that are left behind by the
function is generally called from the
method of the application base view. You can call this function elsewhere as
necessary but you must do so very cautiously to avoid damaging other
applications' undo actions.
function deletes all pending undo
actions--including those posted by other applications. Use this
Using Idler Objects
This section describes how to install an idler object for a specified view. An idler
messages to the view periodically.
Note that an idler object cannot guarantee its
message to be
sent at precisely the time you specify. The
message cannot be
sent until an executing method returns; thus the idler's message may be delayed if a
method is executing when the interval expires.
Using an idler object is straightforward; you need to
message to the view that is to receive the
message. This message takes a single parameter: the
number of milliseconds to wait before sending the first
method that is to be executed. This method
should return the number of milliseconds before the next
message is sent.
again, this time passing in the value 0, or return
. This removes the idler object.
The idler object is removed in any case when the view is closed.