C H A P T E R 2 1
Routing Interface
Using Routing
21-33
Manually Putting Away Items
21
If an item is not put away automatically, it resides in the In Box until the user
chooses to put it away manually by tapping the Put Away button. When the user
taps the Put Away button, the In Box displays a slip showing to which application
the item will be put away. This application is the one that matches the
appSymbol
slot in the item. The In Box sends the
PutAwayScript
message to the base view
of that application. The item is passed as a parameter.
The item passed to your application's
PutAwayScript
method is the entry from
the In Box. It has several slots in it that are used by the In Box or the transport. The
data your application uses is contained in the
body
slot.
Because the item could have been sent by a custom transport that sends
multiple-item target objects (such as those created by
CreateTargetCursor
),
you might need to check if the
body
slot contains such an object by using
TargetIsCursor
. If so, you can get a cursor for the object by using
GetTargetCursor
, and then iterate over the cursor to handle individual items.
If the
PutAwayScript
method returns
nil
, this signals that the item could not
be put away and the In Box leaves the item in the In Box and an alert is displayed
telling the user that the item could not be put away.
If the
PutAwayScript
method returns a non-
nil
value, it is assumed that the
application handled the item. The item is either saved in the In Box or deleted from
the In Box, depending on the user's preference as set in the Put Away slip.
If multiple applications have registered to accept data of the item's class, the system
displays a picker listing those applications in the Put Away slip. The application
that matches the
appSymbol
slot of the item is listed as the default choice. If there
is no
appSymbol
slot, or the application is missing, then a different application is
the default choice. The user can choose the application to which the data is to be
sent, and the
PutAwayScript
message is sent to that application.
The registry used for this operation is called the application data class registry;
note that it is different from the In Box application registry mentioned above.
Applications can register to accept data of one or more classes by using the
RegAppClasses
function.
It is recommended that all applications wanting to receive items through the In Box
register their capability to receive data of particular classes by calling the
RegAppClasses
function. If your application is no longer interested in data of
these classes, or your application is being uninstalled, you can unregister to receive
these data classes by using the
UnRegTheseAppClasses
function.
You can check which applications can accept data of a particular class by using the
ClassAppByClass
function.