Instance Method

initWithPersonHandle:nameComponents:displayName:image:contactIdentifier:customIdentifier:isMe:

Initializes a person object with the specified name, contact information, and flag indicating whether the person is the current device user.

Declaration

- (instancetype)initWithPersonHandle:(INPersonHandle *)personHandle nameComponents:(NSPersonNameComponents *)nameComponents displayName:(NSString *)displayName image:(INImage *)image contactIdentifier:(NSString *)contactIdentifier customIdentifier:(NSString *)customIdentifier isMe:(BOOL)isMe;

Parameters

personHandle

A string containing information that your app uses to identify the user. You can create a person handle from an email address, phone number, or account name associated with the user.

nameComponents

The name of the user, specified as a set of name components.

displayName

The string you display for the user’s name.

image

An image of the person.

contactIdentifier

The identifier associated with the user's CNContact object. Specify a value for this parameter when the user has a corresponding entry in the Contacts database.

customIdentifier

A custom string that you use to identify people in your app.

isMe

A Boolean value indicating whether the person is the current device user.

Return Value

An initialized person object or nil if the object could not be created.

Discussion

It’s essential that you properly set isMe when using Messaging intents. For example, if the message sender for an outgoing message is also the user of the device, set isMe to YES. Similarly, when creating the recipient array for an incoming message—which should include the current user of the device—set isMe to YES for the person in the recipient list that is the current device user, and set isMe to NO for all other recipients.

Use this method when creating person objects you plan to return as part of a response to Siri. Always specify as much information as possible about the user. This method makes copies of the personHandle, nameComponents, displayName, image, contactIdentifier, and customIdentifier parameters instead of keeping the originals.

See Also

Initializing a Person Object

- initWithPersonHandle:nameComponents:displayName:image:contactIdentifier:customIdentifier:

Initializes a person object with the specified name and contact information.

- initWithHandle:displayName:contactIdentifier:

Initializes a person object with the specified display name and contact information.

Deprecated
- initWithHandle:nameComponents:contactIdentifier:

Initializes a person object with the specified display name and contact information.

Deprecated
- initWithHandle:nameComponents:displayName:image:contactIdentifier:

Initializes a person object with the specified name and contact information.

Deprecated