Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Feb 21, 2024

Identify user

Amplify iOS v1 is deprecated as of June 1st, 2024. No new features or bug fixes will be added. Dependencies may become outdated and potentially introduce compatibility issues.

Please use the latest version (v2) of Amplify Library for Swift to get started. Refer to the upgrade guide for instructions on upgrading your application to the latest version.

Amplify libraries should be used for all new cloud connected applications. If you are currently using the AWS Mobile SDK for iOS, you can access the documentation here.

This call sends information that you have specified about the user to Amazon Pinpoint. This could be an authenticated user. If the user is signed in through Amplify.Auth.signIn, then you can retrieve the current user and use it with Analytics. You can also provide location information in AnalyticsUserProfile.Location.

func identifyUser() {
guard let user = Amplify.Auth.getCurrentUser() else {
print("Could not get user, perhaps the user is not signed in")
return
}
let location = AnalyticsUserProfile.Location(latitude: 47.606209,
longitude: -122.332069,
postalCode: "98122",
city: "Seattle",
region: "WA",
country: "USA")
let properties: AnalyticsProperties = ["phoneNumber": "+11234567890", "age": 25]
let userProfile = AnalyticsUserProfile(name: username,
email: "name@example.com",
location: location,
properties: properties)
Amplify.Analytics.identifyUser(user.userId, withProfile: userProfile)
}