Initializer

init(personHandle:nameComponents:displayName:image:contactIdentifier:customIdentifier:aliases:suggestionType:)

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

Declaration

convenience init(personHandle: INPersonHandle, nameComponents: PersonNameComponents?, displayName: String?, image: INImage?, contactIdentifier: String?, customIdentifier: String?, aliases: [INPersonHandle]?, suggestionType: INPersonSuggestionType)

Parameters

personHandle

A string containing information that your app uses to identify the user. You might can 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 can use to identify people in your app.

aliases

An array of INPersonHandle objects containing alternate ways of identifying the user.

suggestionType

The contact information to surface in interactions involving the user. Use this property to identify a user by their social media account name or instant messaging address, instead of by their actual name.

Return Value

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

Discussion

Use this method when you want to create person objects with additional information such as email addresses or phone numbers. This method also lets you suggest how you want to identify the person when donating interactions to the system. For example, you might ask the system to identify the user by their social media account name instead of by their actual name.

Always specify as much information as possible about the user. This method makes copies of the personHandle, nameComponents, displayName, image, contactIdentifier, customIdentifier, and aliases parameters instead of keeping the originals.

See Also

Initializing a Person Object

init(personHandle: INPersonHandle, nameComponents: PersonNameComponents?, displayName: String?, image: INImage?, contactIdentifier: String?, customIdentifier: String?, isMe: Bool)

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

init(handle: String, displayName: String?, contactIdentifier: String?)

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

Deprecated
init(handle: String, nameComponents: PersonNameComponents, contactIdentifier: String?)

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

Deprecated

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software