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 now in Maintenance Mode until May 31st, 2024. This means that we will continue to include updates to ensure compatibility with backend services and security. No new features will be introduced in v1.

Please use the latest version (v2) of Amplify Library for Swift to get started.

If you are currently using v1, follow these instructions to upgrade to v2.

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")
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: "",
location: location,
properties: properties)
Amplify.Analytics.identifyUser(user.userId, withProfile: userProfile)