Side Quest Generating System Mac OS

  1. Side Quest Generating System Mac Os Catalina
  2. Side Quest Generating System Mac Os Download
  3. Side Quest Generating System Mac Os 10 14
  4. Side Quest Generating System Mac Os 7
  5. Side Quest Generating System Mac Os X
Space Quest:
Chapter I – The Sarien Encounter
Developer(s)Sierra On-Line
Publisher(s)Sierra On-Line
Designer(s)Mark Crowe
Scott Murphy
Programmer(s)Scott Murphy
Sol Ackerman
Ken Williams
Artist(s)Mark Crowe
Composer(s)Mark Crowe
SeriesSpace Quest
EngineAGI
Platform(s)DOS, Macintosh, Apple II, Apple IIGS, Amiga, Atari ST
ReleaseOctober 1986
Genre(s)Adventure
Mode(s)Single-player

Space Quest: Chapter I – The Sarien Encounter, commonly known as Space Quest I, is a graphic adventure game released in October 1986 by Sierra On-Line.[1] It is the first game in the Space Quest series. It quickly became a hit, selling in excess of 100,000 copies. Total sales are believed to be around 200,000 to date, not including the many compilations it has been included in.[citation needed]

Space Quest was the brainchild of Sierra programmers Scott Murphy and Mark Crowe, who had worked on prior titles like King's Quest II, but had not designed their own game before. According to Murphy, 'at that time (1985), everything at Sierra was so somber and had an almost medieval atmosphere. So we decided 'Why not make a fun, silly game?'[2] In 1992, Adventure Comics created a three issue comic, based on the game's plot.[3]

Plot[edit]

Players of the original game are never told the hero's name, but are instead asked to enter their own. The default name of 'Roger Wilco' — a reference to the radio communication, 'Roger, Will Comply' — became the de facto name of the hero in the later games of the series.

Guest OS (guest operating system): A guest OS is the software installed on either a virtual machine (VM) or partitioned disk that describes an operating system that is different than the host operating system. On Mac OS X, getgroups behavior differs somewhat from other Unix platforms. If the Python interpreter was built with a deployment target of 10.5 or earlier, getgroups returns the list of effective group ids associated with the current user process; this list is limited to a system-defined number of entries, typically 16, and may be modified by calls to setgroups if suitably privileged.

Roger is a janitor on board the scientific spaceship Arcada within the Earnon galaxy which holds a powerful experimental device called the 'Star Generator' (a thinly-veiled reference to the Genesis Device from Star Trek II: The Wrath of Khan). Roger emerges from an on-duty nap in a broom closet to find that the ship has been boarded and seized by the sinister Sariens. Using a keycard that he finds on the body of a dead crew member, he finds his way to an escape pod and escapes the Arcada.

After crash-landing, he finds himself in the dry and barren wasteland of the planet Kerona, hunted by a spider-droid dispatched by the Sariens. Roger makes his way through the desert and a system of caves and is greeted by a mysterious disembodied head, he is tasked with killing a monstrous creature called Orat in exchange for transportation. After succeeding in this task and in the evasion of the hunter droid, he returns to the alien head with proof of his success in the form of a piece of Orat's flesh. As a reward, he is allowed into an underground complex inhabited by other aliens of the same species, and is provided with a skimmer, a small hovercraft (a direct reference to the landspeeders in Star Wars).

Roger travels to a Ulence Flats (a direct reference to Star Wars' Mos Eisley), a desert town, in order to find a way off the planet. Roger wins enough money to buy a spaceship and a navigation droid by playing slot machines in a cantina.

He overhears from a bar customer the location of the Sariens' spaceship, the Deltaur, and flies to its coordinates. He then infiltrates the ship by, but not limited to, utilizing his jetpack, dodging a droid, climbing inside an air vent, locking himself in a trunk, getting put inside a washing machine, disguising himself as a Sarien by wearing one of the Sarien uniforms, and other tactful, creative methods. He then finds his way to the Star Generator and programs it to self-destruct, escaping the ship just before it explodes.

At the end of the game, Roger's efforts are rewarded when he receives the Golden Mop as a token of eternal gratitude from the people of Xenon.

Gameplay[edit]

The game was created using Sierra's AGI engine and featured a pseudo-3D environment, allowing the character to move in front of and behind background objects. The primary means of input in Space Quest, as in many other AGI games, was through the use of a text parser for entering commands and use of the keypad or arrow keys for moving Roger Wilco around the screen. The Amiga, Apple IIGS, Atari ST and Mac versions of the game offered basic mouse support for movement as well. The game had a 160×200 resolution displaying 16 colors. Sound cards were not available in 1986, so sound was played through the PC's internal speaker; owners of Tandy 1000, PCjr and Amiga computers would hear a three-voice soundtrack, while Apple IIGS owners were treated to a fifteen-voice soundtrack with notably richer sound.

A precursor of this game is the interactive fiction game Planetfall, created by Infocom, whose player-character is a lowly 'Ensign Seventh Class' who does the lowest form of labor aboard a spaceship and who appears on the cover with a mop. Just as King's Quest adapted the text-adventure puzzle games set in a medieval world to a visual display, Space Quest did the same for the space puzzle game.

As a form of copy protection, coordinates in the VGA version of the game while in the escape pod as well as the rocket purchased at Tiny's Used Spaceships are only found in the manual. Also, the code for retrieving the cartridge aboard the Arcada can only be found in the manual. The AGI version had key disk protection where the user was required to insert the original game floppy on startup.

Sierra released three versions of Space Quest: the original 1986 AGI V2 release, the 1987 AGI V3 release, and the 1990 VGA release. Aside from minor sound and graphic differences, the PC, Amiga, Atari ST, and Apple IIGS versions are largely identical. The Mac version is considerably different, however, being monochrome and completely menu-driven. Space Quest I also had an 8-bit Apple II version for the IIe and IIc. This had no pull down menus and displayed all text at the bottom of the screen.

Along with King's Quest III, Space Quest was the first Sierra game to feature pull down menus, be hard disk installable, and not require a specially formatted save disk (except the Apple II version as noted above).

Reception[edit]

Compute! praised the Apple IIGS version's sound and graphics, stating that players 'may think they're watching a cartoon'. It concluded that the game 'is one of the better new adventure games to arrive'.[4]

The game contains a number of characters which resemble musical acts and other popular characters. The owners of a couple complained that Sierra had used them without permission. Toys R Us complained about a robot shop named 'Droids R Us', which Sierra changed to 'Droids B Us'; the remake adds a character which resembles the toy company's mascot Geoffrey Giraffe.[citation needed] Rock band ZZ Top complained that a band seen briefly on stage resembled them – despite this, they re-appear in certain versions of the VGA remake.[5]

According to Sierra On-Line, combined sales of the Space Quest series surpassed 1.2 million units by the end of March 1996.[6]

Remake[edit]

Space Quest I:
Roger Wilco in the Sarien Encounter
Developer(s)Sierra On-Line
Publisher(s)Sierra On-Line
Director(s)Bill Davis(creative)
Designer(s)Mark Crowe
Scott Murphy
Composer(s)Ken Allen
SeriesSpace Quest
EngineSCI1
Platform(s)DOS, Macintosh, Amiga
ReleaseAugust 20, 1991
Genre(s)Adventure
Mode(s)Single-player

Space Quest was eventually remade using Sierra's newer SCIgame engine, which, among many other improvements, allowed the game to move from its original 16-color EGA graphics to 256-color VGA. Rebranded Space Quest I: Roger Wilco in the Sarien Encounter to follow the series' new naming convention introduced in Space Quest IV, this version was released on August 20, 1991. In addition to the new VGA graphics, which were drawn in 1950s retrofuturisticB-movie style, it now featured digitized sounds and a new interface, with text-entry being replaced by an icon interface.

When leaving Ulence Flats in the VGA version, the time pod from Space Quest IV appears. Space Quest IV was developed around the same time. However, a continuity error occurs, as the time pod appears in a different place than in Space Quest IV.

Reception[edit]

The 1991 remake of the game was reviewed in Dragon, receiving 5 out of 5 stars.[7]

References[edit]

  1. ^Weston, D.B. Greatest Moments in Video Game History. p. 52. ISBN978-1-301-17414-0.
  2. ^Purcaru, John Bogdan (29 January 2014). Games vs. Hardware. The History of PC video games: The 80's. Google Books. p. 296. Retrieved 11 December 2016.
  3. ^''Adventure Comics (Firm)' to 'Adventure Series''. Michigan State University Libraries. Retrieved 2020-03-25.
  4. ^Trunzo, James V. (August 1988). 'Space Quest — The Sarien Encounter'. Compute!. p. 70.
  5. ^'Space Quest 1 Cameo Appearances'. SpaceQuest.Net. Retrieved 2012-08-27.
  6. ^Sierra On-Line Form 10-K (Report). Bellevue, Washington. March 31, 1996. pp. 7–9. Archived from the original on April 16, 2018.
  7. ^Lesser, Hartley; Lesser, Patricia & Lesser, Kirk (January 1992). 'The Role of Computers'. Dragon. No. 177. pp. 57–66.

External links[edit]

  • Space Quest: Chapter I – The Sarien Encounter at MobyGames
  • Space Quest I: Roger Wilco in the Sarien Encounter at MobyGames
Retrieved from 'https://en.wikipedia.org/w/index.php?title=Space_Quest_I&oldid=1004059049'

The XPC Services API, part of libSystem, provides a lightweight mechanism for basic interprocess communication integrated with Grand Central Dispatch (GCD) and launchd. The XPC Services API allows you to create lightweight helper tools, called XPC services, that perform work on behalf of your application.

There are two main reasons to use XPC services: privilege separation and stability.

Stability:

Let’s face it; applications sometimes crash. We don’t want it to happen, but it does anyway. Often, certain parts of an application are more prone to crashes than others. For example, the stability of any application with a plug-in API is inherently at the mercy of the authors of plug-ins.

When one part of an application is more at risk for crashes, it can be useful to separate out the potentially unstable functionality from the core of the application. This separation lets you ensure that that, if it crashes, the rest of the application is not affected.

Privilege Separation:

Modern applications increasingly rely on untrusted data, such as web pages, files sent by email, and so on. This represents a growing attack vector for viruses and other malware.

With traditional applications, if an application becomes compromised through a buffer overflow or other security vulnerability, the attacker gains the ability to do anything that the user can do. To mitigate this risk, Mac OS X provides sandboxing—limiting what types of operations a process can perform.

In a sandboxed environment, you can further increase security with privilege separation—dividing an application into smaller pieces that are responsible for a part of the application’s behavior. This allows each piece to have a more restrictive sandbox than the application as a whole would require.

Other mechanisms for dividing an application into smaller parts, such as NSTask and posix_spawn, do not let you put each part of the application in its own sandbox, so it is not possible to use them to implement privilege separation. Each XPC service has its own sandbox, so XPC services can make it easier to implement proper privilege separation.

For more information about sandboxing, see App Sandbox Design Guide.

Understanding the Structure and Behavior

XPC services are managed by launchd, which launches them on demand, restarts them if they crash, and terminates them (by sending SIGKILL) when they are idle. This is transparent to the application using the service, except for the case of a service that crashes while processing a message that requires a response. In that case, the application can see that its XPC connection has become invalid until the service is restarted by launchd. Because an XPC service can be terminated suddenly at any time, it must be designed to hold on to minimal state—ideally, your service should be completely stateless, although this is not always possible.

By default, XPC services are run in the most restricted environment possible—sandboxed with minimal filesystem access, network access, and so on. Elevating a service’s privileges to root is not supported. Further, an XPC service is private, and is available only to the main application that contains it.

Choosing an XPC API

Beginning in Mac OS X v10.8, there are two different APIs for working with XPC services: the XPC Services API and the NSXPCConnection API.

The NSXPCConnection API is an Objective-C-based API that provides a remote procedure call mechanism, allowing the client application to call methods on proxy objects that transparently relay those calls to corresponding objects in the service helper and vice-versa.

The XPC Services API is a C-based API that provides basic messaging services between a client application and a service helper.

Side Quest Generating System Mac Os Catalina

The XPC Services API is recommended if you need compatibility with Mac OS X v10.7, or if your application and its service are not based on the Foundation framework. The NSXPCConnection API is recommended for apps based on the Foundation framework in Mac OS X v10.8 and later.

The NSXPCConnection API

The NSXPCConnection API is part of the Foundation framework, and is described in the NSXPCConnection.h header file. It consists of the following pieces:

  • NSXPCConnection—a class that represents the bidirectional communication channel between two processes. Both the application and the service helper have at least one connection object.

  • NSXPCInterface—a class that describes the expected programmatic behavior of the connection (what classes can be transmitted across the connection, what objects are exposed, and so on).

  • NSXPCListener—a class that listens for incoming XPC connections. Your service helper must create one of these and assign it a delegate object that conforms to the NSXPCListenerDelegate protocol.

  • NSXPCListenerEndpoint—a class that uniquely identifies an NSXPCListener instance and can be sent to a remote process using NSXPCConnection. This allows a process to construct a direct communication channel between two other processes that otherwise could not see one another.

In addition, the header contains a few constants, described in NSXPCConnection Constants Reference.

The XPC Services API

The (C-based) XPC Services API consists of two main pieces:

  • xpc.h—APIs for creating and manipulating property list objects and APIs that daemons use to reply to messages.

    Because this API is at the libSystem level, it cannot depend on Core Foundation. Also, not all CF types can be readily shared across process boundaries. XPC supports connection types such as file descriptors in its object graphs, which are not supported by CFPropertyList because it was designed as a persistent storage format, whereas XPC was designed as an IPC format. For these reasons, the XPC API uses its own container that supports only the primitives that are practical to transport across process boundaries.

    Some higher-level types can be passed across an XPC connection, although they do not appear in the xpc.h header file (because referencing higher level frameworks from libSystem would be a layering violation). For example, the IOSurfaceCreateXPCObject and IOSurfaceLookupFromXPCObject functions allow you to pass an IOSurface object between the XPC service that does the drawing and the main application.

  • connection.h—APIs for connecting to an XPC service. This service is a special helper bundle embedded in your app bundle.

    A connection is a virtual endpoint; it is independent of whether an actual instance of the service binary is running. The service binary is launched on demand.

    A connection can also be sent as a piece of data in an XPC message. Thus, you can pass a connection through XPC to allow one service to communicate with another service (for example).

Note: The underlying encoding used by XPC is opaque to the user, and so is the communication channel. You should not attempt to interact directly with either, as they are subject to change without notice.

You should also not try to archive the bytes of a message or the objects that contain it to disk; the encoding is not considered an ABI contract, and may change at any time.

Creating the Service

An XPC service is a bundle in the Contents/XPCServices directory of the main application bundle; the XPC service bundle contains an Info.plist file, an executable, and any resources needed by the service. The XPC service indicates which function to call when the service receives messages by calling xpc_main(3) Mac OS X Developer Tools Manual Page from its main function.

To create an XPC service in Xcode, do the following:

  1. Add a new target to your project, using the XPC Service template.

  2. Add a Copy Files phase to your application’s build settings, which copies the XPC service into the Contents/XPCServices directory of the main application bundle.

  3. Add a dependency to your application’s build settings, to indicate it depends on the XPC service bundle.

  4. If you are writing a low-level (C-based) XPC service, implement a minimal main function to register your event handler, as shown in the following code listing. Replace my_event_handler with the name of your event handler function.

    If you are writing a high-level (Objective-C-based) service using NSXPCConnection, first create a connection delegate class that conforms to the NSXPCListenerDelegate protocol. Then, implement a minimal main function that creates and configures a listener object, as shown in the following code listing.

    The details of this class are described further in Using the Service.

  5. Add the appropriate key/value pairs to the helper’s Info.plist to tell launchd the name of the service. These are described in XPC Service Property List Keys.

Note: If you want to sandbox your service, it must also be signed; entitlements are stored as part of the code signature.

Using the Service

The way you use an XPC service depends on whether you are working with the C API (XPC Services) or the Objective-C API (NSXPCConnection).

Using the Objective-C NSXPCConnection API

The Objective-C NSXPCConnection API provides a high-level remote procedure call interface that allows you to call methods on objects in one process from another process (usually an application calling a method in an XPC service). The NSXPCConnection API automatically serializes data structures and objects for transmission and deserializes them on the other end. As a result, calling a method on a remote object behaves much like calling a method on a local object.

To use the NSXPCConnection API, you must create the following:

  • An interface. This mainly consists of a protocol that describes what methods should be callable from the remote process. This is described in Designing an Interface

  • A connection object on both sides. On the service side, this was described previously in Creating the Service. On the client side, this is described in Connecting to and Using an Interface.

  • A listener. This code in the XPC service accepts connections. This is described in Accepting a Connection in the Helper.

  • Messages.

Figure 4-1 shows how these pieces fit together.

Side Quest Generating System Mac Os Download

In some cases, you may need to further tweak the protocol to whitelist additional classes for use in collection parameters or to proxy certain objects instead of copying them. This is described further in Working with Custom Classes.

Overall Architecture

When working with NSXPCConnection-based helper apps, both the main application and the helper have an instance of NSXPCConnection. The main application creates its connection object itself, which causes the helper to launch. A delegate method in the helper gets passed its connection object when the connection is established. This is illustrated in Figure 4-1.

Each NSXPCConnection object provides three key features:

  • An exportedInterface property that describes the methods that should be made available to the opposite side of the connection.

  • An exportedObject property that contains a local object to handle method calls coming in from the other side of the connection.

  • The ability to obtain a proxy object for calling methods on the other side of the connection.

When the main application calls a method on a proxy object, the XPC service’s NSXPCConnection object calls that method on the object stored in its exportedObject property.

Similarly, if the XPC service obtains a proxy object and calls a method on that object, the main app’s NSXPCConnection object calls that method on the object stored in its exportedObject property.

Designing an Interface

The NSXPCConnection API takes advantage of Objective-C protocols to define the programmatic interface between the calling application and the service. Any instance method that you want to call from the opposite side of a connection must be explicitly defined in a formal protocol. For example:

Because communication over XPC is asynchronous, all methods in the protocol must have a return type of void. If you need to return data, you can define a reply block like this:

A method can have only one reply block. However, because connections are bidirectional, the XPC service helper can also reply by calling methods in the interface provided by the main application, if desired.

Each method must have a return type of void, and all parameters to methods or reply blocks must be either:

  • Arithmetic types (int, char, float, double, uint64_t, NSUInteger, and so on)

  • BOOL

  • C strings

  • C structures and arrays containing only the types listed above

  • Objective-C objects that implement the NSSecureCoding protocol.

Important: If a method (or its reply block) has parameters that are Objective-C collection classes (NSDictionary, NSArray, and so on), and if you need to pass your own custom objects within a collection, you must explicitly tell XPC to allow that class as a member of that collection parameter. For details, read Working with Custom Classes.

Connecting to and Using an Interface

Once you have defined the protocol, you must create an interface object that describes it. To do this, call the interfaceWithProtocol: method on the NSXPCInterface class. For example:

Once you have created the interface object, within the main app, you must configure a connection with it by calling the initWithServiceName: method. For example:

Note: For communicating with XPC services outside your app bundle, you can also configure an XPC connection with the initWithMachServiceName: method. For details, see the documentation for that method.

Figure 4-2 shows the basic steps in this process. Note that only the first four steps are described in this section.

At this point, the main application can call the remoteObjectProxy or remoteObjectProxyWithErrorHandler: methods on the myConnection object to obtain a proxy object. This object acts as a proxy for the object that the XPC service has set as its exported object (by setting the exportedObject property). This object must conform to the protocol defined by the remoteObjectInterface property.

When your application calls a method on the proxy object, the corresponding method is called on the exported object inside the XPC service. When the service’s method calls the reply block, the parameter values are serialized and sent back to the application, where the parameter values are deserialized and passed to the reply block. (The reply block executes within the application’s address space.)

Note: If you want to allow the helper process to call methods on an object in your application, you must set the exportedInterface and exportedObject properties before calling resume. These properties are described further in the next section.

Accepting a Connection in the Helper

As shown in Figure 4-2, when an NSXPCConnection-based helper receives the first message from a connection, the listener delegate’s listener:shouldAcceptNewConnection: method is called with a listener object and a connection object. This method lets you decide whether to accept the connection or not; it should return YES to accept the connection or NO to refuse the connection.

Note: The helper receives a connection request when the first actual message is sent. The connection object’s resume method does not cause a message to be sent.

In addition to making policy decisions, this method must configure the connection object. In particular, assuming the helper decides to accept the connection, it must set the following properties on the connection:

  • exportedInterface—an interface object that describes the protocol for the object you want to export. (Creating this object was described previously in Connecting to and Using an Interface.)

  • exportedObject—the local object (usually in the helper) to which the remote client’s method calls should be delivered. Whenever the opposite end of the connection (usually in the application) calls a method on the connection’s proxy object, the corresponding method is called on the object specified by the exportedObject property.

After setting those properties, it should call the connection object’s resume method before returning YES. Although the delegate may defer calling resume, the connection will not receive any messages until it does so.

Side Quest Generating System Mac OS

Sending Messages

Sending messages with NSXPC is as simple as making a method call. For example, given the interface myCookieInterface (described in previous sections) on the XPC connection object myConnection, you can call the feedMeACookie method like this:

When you call that method, the corresponding method in the XPC helper is called automatically. That method, in turn, could use the XPC helper’s connection object similarly to call a method on the object exported by the main application.

Handling Errors

In addition to any error handling methods specific to a given helper’s task, both the XPC service and the main app should also provide the following XPC error handler blocks:

  • Interruption handler—called when the process on the other end of the connection has crashed or has otherwise closed its connection.

    The local connection object is typically still valid—any future call will automatically spawn a new helper instance unless it is impossible to do so—but you may need to reset any state that the helper would otherwise have kept.

    The handler is invoked on the same queue as reply messages and other handlers, and it is always executed after any other messages or reply block handlers (except for the invalidation handler). It is safe to make new requests on the connection from an interruption handler.

  • Invalidation handler—called when the invalidate method is called or when an XPC helper could not be started. When this handler is called, the local connection object is no longer valid and must be recreated.

    This is always the last handler called on a connection object. When this block is called, the connection object has been torn down. It is not possible to send further messages on the connection at that point, whether inside the handler or elsewhere in your code.

In both cases, you should use block-scoped variables to provide enough contextual information—perhaps a pending operation queue and the connection object itself—so that your handler code can do something sensible, such as retrying pending operations, tearing down the connection, displaying an error dialog, or whatever other actions make sense in your particular app.

Working with Custom Classes

Note: Before you read this section, you should read the chapters Serializations and Serializing Property Lists in Archives and Serializations Programming Guide to learn the basics of object serialization in Mac OS X.

The NSXPCConnection class limits what objects can be passed over a connection. By default, it allows only known-safe classes—Foundation collection classes, NSString, and so on. You can identify these classes by whether they conform to the NSSecureCoding protocol.

Only classes that conform to this protocol can be sent to an NSXPCConnection-based helper. If you need to pass your own classes as parameters, you must ensure that they conform to the NSSecureCoding protocol, as described below.

However, this is not always sufficient. You need to do extra work in two situations:

  • If you are passing the object inside a collection (dictionary, array, and so on).

  • If you need to pass the object by proxy instead of copying the object.

All three cases are described in the sections that follow.

Conforming to NSSecureCoding

All objects passed over an NSXPC connection must conform to NSSecureCoding. to do this, your class must do the following:

  • Declare support for secure coding. Override the supportsSecureCoding method, and make it return YES.

  • Decode singleton class instances safely. If the class overrides its initWithCoder: method, when decoding any instance variable, property, or other value that contains an object of a non-collection class (including custom classes) always use decodeObjectOfClass:forKey: to ensure that the data is of the expected type.

  • Decode collection classes safely. Any non-collection class that contains instances of collection classes must override the initWithCoder: method. In that method, when decoding the collection object or objects, always use decodeObjectOfClasses:forKey: and provide a list of any objects that can appear within the collection.

When generating the list of classes to allow within a decoded collection class, you should be aware of two things.

First, Apple collection classes are not automatically whitelisted by the decodeObjectOfClasses:forKey: method, so you must include them explicitly in the array of class types.

Second, you should list only classes that are direct members of the collection object graph that you are decoding without any intervening non-collection classes.

For example, if you have an array of dictionaries, and one of those dictionaries might contain an instance of a custom class called OuterClass, and OuterClass has an instance variable of type InnerClass, you must include OuterClass in the list of classes because it is a direct member of the collection tree. However, you do not need to list InnerClass because there is a non-collection object between it and the collection tree.

Figure 4-3 shows some examples of when whitelisting is required and shows when classes must provide overridden initWithCoder: methods.

Whitelisting a Class for Use Inside Containers

Most of the time, custom classes passed through method parameters can be automatically whitelisted based upon the method’s signature. However, when a method specifies a collection class (NSArray, NSDictionary, and so on) as the parameter type, the compiler has no way to determine what classes should be allowed to appear within that container. For this reason, if your methods take collection class instances as parameters, you must explicitly whitelist any classes that can appear within those containers.

For every method in your interface that takes a collection class as a parameter, you must determine what classes should be allowed as members.

You should whitelist only classes that can be members of any top-level collection objects. If you whitelist classes at the top level unnecessarily, those objects are allowed to appear within the top-level collection objects, which is not what you want. In particular:

  • Apple-provided classes that support property list serialization (such as other collection classes) are automatically whitelisted for you. It is never necessary to whitelist these classes at the top level.

    For the most up-to-date list of classes supported by property list serialization, read Serializing Property Lists in Archives and Serializations Programming Guide.

  • Don’t whitelist custom classes if they are allowed only inside instances of other custom classes. If the enclosing class correctly conforms to NSSecureCoding, such whitelisting is not required. For more details, read Conforming to NSSecureCoding.

For example, suppose you have the following class and protocol:

Assuming the pommesFrites array is an array of FrenchFry objects (as the name implies), you would whitelist the array of FrenchFry objects as follows:

Side Quest Generating System Mac Os 10 14

The first parameter to a method is parameter 0, followed by parameter 1, and so on.

In this case, the value NO is passed for the ofReply parameter because this code is modifying the whitelist for one of the parameters of the method itself. If you are whitelisting a class for a parameter of the method’s reply block, pass YES instead.

Passing an Object By Proxy

Most of the time, it makes sense to copy objects and send them to the other side of a connection. Passing objects by copying is the most straightforward way to use NSXPC, and should be used wherever possible.

However, copying objects is not always desirable. In particular:

  • If you need to share a single instance of the data between the client application and the helper, you must pass the objects by proxy.

  • If an object needs to call methods on other objects within your application that you cannot or do not wish to pass across the connection (such as user interface objects), then you must pass an object by proxy—either the caller, the callee (where possible), or a relay object that you construct specifically for that purpose.

The downside to passing objects by proxy is that performance is significantly reduced (because every access to the object requires interprocess communication). For this reason, you should pass objects by proxy only if it is not possible to pass them by copying.

You can configure additional proxy objects similarly to the way you configured the remoteObjectInterface property of the initial connection. First, identify which parameter to a method should be passed by proxy, then specify an NSXPCInterface object that defines the interface for that object.

Suppose, for example, that you have a class conforming to the following protocol:

If you want to pass the first parameter to that method by proxy, you would configure the interface like this:

The first parameter to a method is parameter 0, followed by parameter 1, and so on.

In this case, the value NO is passed for the ofReply parameter because this code is modifying the whitelist for one of the parameters of the method itself. If you are whitelisting a class for a parameter of the method’s reply block, pass YES instead.

Using the C XPC Services API

Typical program flow is as follows:

  1. An application calls xpc_connection_create(3) Mac OS X Developer Tools Manual Page to create an an XPC connection object.

  2. The application calls some combination of xpc_connection_set_event_handler(3) Mac OS X Developer Tools Manual Page or xpc_connection_set_target_queue(3) Mac OS X Developer Tools Manual Page as needed to configure connection parameters prior to actually connecting to the service.

  3. The application calls xpc_connection_resume(3) Mac OS X Developer Tools Manual Page to begin communication.

  4. The application sends messages to the service using xpc_connection_send_message(3) Mac OS X Developer Tools Manual Page, xpc_connection_send_message_with_reply(3) Mac OS X Developer Tools Manual Page, or xpc_connection_send_message_with_reply_sync(3) Mac OS X Developer Tools Manual Page.

  5. When you send the first message, the launchd daemon searches your application bundle for a service bundle whose CFBundleIdentifier value matches the specified name, then launches that XPC service daemon on demand.

  6. The event handler function (specified in the service’s Info.plist file) is called with the message. The event handler function runs on a queue whose name is the name of the XPC service.

  7. If the original message was sent using xpc_connection_send_message_with_reply(3) Mac OS X Developer Tools Manual Page or xpc_connection_send_message_with_reply_sync(3) Mac OS X Developer Tools Manual Page, the service must reply using xpc_dictionary_create_reply(3) Mac OS X Developer Tools Manual Page, then uses xpc_dictionary_get_remote_connection(3) Mac OS X Developer Tools Manual Page to obtain the client connection and xpc_connection_send_message(3) Mac OS X Developer Tools Manual Page, xpc_connection_send_message_with_reply(3) Mac OS X Developer Tools Manual Page, or xpc_connection_send_message_with_reply_sync(3) Mac OS X Developer Tools Manual Page to send the reply dictionary back to the application.

    The service can also send a message directly to the application with xpc_connection_send_message(3) Mac OS X Developer Tools Manual Page.

  8. If a reply was sent by the service, the handler associated with the previous message is called upon receiving the reply. The reply can be put on a different queue than the one used for incoming messages. No serial relationship is guaranteed between reply messages and non-reply messages.

  9. If an error occurs (such as the connection closing), the connection’s event handler (set by a previous call to xpc_connection_set_event_handler(3) Mac OS X Developer Tools Manual Page) is called with an appropriate error, as are (in no particular order) the handlers for any outstanding messages that are still awaiting replies.

  10. At any time, the application can call xpc_connection_suspend(3) Mac OS X Developer Tools Manual Page when it needs to suspend callbacks from the service. All suspend calls must be balanced with resume calls. It is not safe to release the last reference to a suspended connection.

  11. Eventually, the application calls xpc_connection_cancel(3) Mac OS X Developer Tools Manual Page to terminate the connection.

    Note: Either side of the connection can call xpc_connection_cancel(3) Mac OS X Developer Tools Manual Page. There is no functional difference between the application canceling the connection and the service canceling the connection.

XPC Service Property List Keys

XPC requires you to specify a number of special key-value pairs in the Info.plist file within the service helper’s bundle. These keys are listed below.

CFBundleIdentifier

String. The name of the service in reverse-DNS style (for example, com.example.myapp.myservice). (This value is filled in by the XPC Service template.)

CFBundlePackageType

String. Value must be XPC! to identify the bundle as an XPC service. (This value is filled in by the XPC Service template.)

XPCService

Dictionary. Contains the following keys:

Side Quest Generating System Mac Os 7

Key

Value

EnvironmentVariables

Dictionary. The variables which are set in the environment of the service.

JoinExistingSession

Boolean. Indicates that your service runs in the same security session as the caller.

The default value is False, which indicates that the service is run in a new security session.

Set the value to True if the service needs to access to the user’s keychain, the pasteboard, or other per-session resources and services.

RunLoopType

String. Indicates the type of run loop used for the service. The default value is dispatch_main, which uses the dispatch_main(3) Mac OS X Developer Tools Manual Page function to set up a GCD-style run loop. The other supported value is NSRunLoop, which uses the NSRunLoop class to set up a run loop.



Side Quest Generating System Mac Os X

Copyright © 2003, 2016 Apple Inc. All Rights Reserved. Terms of Use Privacy Policy Updated: 2016-09-13