# Contacts for the Apple SDK

Identify contacts, reset contacts, and get named user IDs.

A Contact is any user in your project. Contacts are identified as either an Anonymous Contact or a Named User. Airship can set targeting data on these identifiers, which are also used to map devices and channels to a specific user. For detailed information about contacts and named users, see [Named users](https://www.airship.com/docs/guides/audience/named-users/).

## Managing the Contact's identifier (Named User ID)

Identify can be called multiple times with the same Named User ID. The SDK will automatically deduplicate `identify`
calls made with the same Named User ID. If the ID is changed from a previous value, the Contact will automatically 
be dissociated from the previous Named User ID.


#### Swift


```swift
Airship.contact.identify("some named user ID")
```



#### Objective-C


```objective-c
[UAirship.contact identify:@"some named user ID"];
```




If the user logs out of the device, you may want to reset the contact. This will clear
any anonymous data and dissociate the contact from the Named User ID, if set. This
should only be called when the user manually logs out of the app, otherwise you will
not be able to target the Channel by its Contact data. 


#### Swift


```swift
Airship.contact.reset()
```



#### Objective-C


```objc
[UAirship.contact reset];
```




You can get the Named User ID only if you set it through the SDK.


#### Swift


```swift
await Airship.contact.namedUserID
```



#### Objective-C


```objc
[UAirship.contact getNamedUserIDWithCompletionHandler:^(NSString *namedUserID) {

}];
```




### Email channel association
 
When an email address is registered through the SDK, it will be registered for both transactional and commercial emails by default. To change this behavior, you can override the options to request [[Double Opt-In](https://www.airship.com/docs/reference/glossary/#double_opt_in)](https://www.airship.com/docs/developer/api-integrations/email/getting-started/#double-opt-in) for commercial messages.


#### Swift


```swift
let options = EmailRegistrationOptions.commercialOptions(
    transactionalOptedIn: transactionalDate,
    commercialOptedIn: commercialDate,
    properties: properties
)
Airship.contact.registerEmail("your@example.com", options: options)
```



#### Objective-C


```objc
UAEmailRegistrationOptions* options = [UAEmailRegistrationOptions commercialOptionsWithTransactionalOptedIn:transactionalDate commercialOptedIn:commercialDate properties:properties];
[UAirship.contact registerEmail:@"your@example.com" options:options];
```




### SMS channel association

When an [MSISDN](https://www.airship.com/docs/reference/glossary/#msisdn) is registered through the SDK, Airship sends a message to that number, prompting them to opt in. For more information, see the SMS platform documentation: [Non-Mobile Double Opt-In](https://www.airship.com/docs/developer/api-integrations/sms/opt-in-out-handling/#non-mobile-double-opt-in).


#### Swift


```swift
let options = SMSRegistrationOptions.optIn(senderID: "senderId")
Airship.contact.registerSMS("yourMsisdn", options: options)
```



#### Objective-C


```objc
UASMSRegistrationOptions* options = [UASMSRegistrationOptions optInSenderID:@"senderId"];
[UAirship.contact registerSMS:"yourMsisdn" options:options];
```




### Open Channel association

Open Channels support notifications to any medium that can accept a JSON payload, through either the Airship API or web dashboard.
For more information about Open Channels, see the [Open Channels documentation](https://www.airship.com/docs/developer/api-integrations/open/getting-started/).


#### Swift


```swift
let options = OpenRegistrationOptions.optIn(platformName: "platformName", identifiers: identifiers)
Airship.contact.registerOpen("address", options: options)
```



#### Objective-C


```objc
UAOpenRegistrationOptions* options = [UAOpenRegistrationOptions optInSenderID:@"platformName"];
[UAirship.contact registerOpen:"address" options:options];
```



