Skip to main content
Get your iOS app connected to social.plus in just a few steps. This guide covers everything from installation to your first authenticated session.

Requirements

  • Xcode 26.0+
  • iOS 13.0+
  • Swift 6.0+

Installation

Objective-C Integration

Starting with v6.0.0, AmitySDK for iOS is written in Pure Swift. You can still use it in Objective-C projects by creating a Mixed-Language Project.
We recommend integrating AmitySDK directly into your Objective-C project and using Swift language to call the SDK interfaces for better compatibility and performance.

Mixed Language Project Setup

Create Swift files with necessary interfaces/methods that interact with AmitySDK. These interfaces should be exposed with @objc or @objcMembers attributes. When you add a new Swift file to your Objective-C project, Xcode automatically generates a bridging header file that exposes your Swift code to Objective-C.

Implementation Example

  • Swift Bridge File
  • Objective-C Usage
Create a Swift file that wraps AmitySDK functionality:
// SDKLoginManager.swift
// Example of a Swift file which contains a class to interact with AmitySDK

import AmitySDK

@objc class SDKLoginManager: NSObject {
    
    let client: AmityClient?
    
    @objc init(apiKey: String) {
        self.client = try? AmityClient(apiKey: apiKey)
    }
    
    @objc func login(userId: String, displayName: String, authToken: String, completion: @escaping (Bool, Error?) -> Void) {
        self.client?.login(userId: userId, displayName: displayName, authToken: authToken, completion: completion)
    }
    
    @objc func logout() {
        self.client?.secureLogout()
    }
    
    @objc func isLoggedIn() -> Bool {
        return self.client?.sessionState == .established ?? false
    }
    
    @objc func getCurrentUserId() -> String? {
        return self.client?.getCurrentUserId()
    }
}

Key Considerations

Bridging Header: Xcode automatically creates a bridging header when you add Swift files to an Objective-C project.Import Statement: Use #import "YourProjectName-Swift.h" to access Swift classes in Objective-C.Target Membership: Ensure your Swift files are added to the correct target.
Minimize Bridge Calls: Create comprehensive wrapper methods rather than making frequent cross-language calls.Error Handling: Properly handle Swift optionals and errors in your Objective-C code.Threading: Always dispatch UI updates to the main queue when handling completion callbacks.
Module Not Found: Ensure your project’s module name doesn’t contain special characters or spaces.Swift Version: Make sure your Objective-C project supports the Swift version used by AmitySDK.Linker Errors: Verify that both Objective-C and Swift files are properly linked to your target.

Next Steps

Troubleshooting

Framework not found: Ensure you’ve added all required frameworks and set them to “Embed & Sign”M1 Mac Simulator Issues: Enable Rosetta for your application in XcodeSwift version conflicts: Ensure your project uses Swift 5.0 or later
SDK not initialized: Make sure you call AmityClient.setup(...) in application delegateAuthentication failures: Verify your API key and region settingsPermission denied: Check that required permissions are added to Info.plist