Observer mode
Configure the SDK
import Purchasely
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Purchasely.start(withAPIKey: "API_KEY", appUserId: "USER_ID", observerMode: true)
return true
}
#import <Purchasely/Purchasely-Swift.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[Purchasely startWithAPIKey:@"API_KEY"
appUserId:@"USER_ID"
observerMode:true
eventDelegate:nil
uiDelegate:nil
confirmPurchaseHandler:nil
logLevel: LogLevelInfo];
return YES;
}Purchasely.userLogin(with: "123456789")[Purchasely userLoginWith:@"123456789"];Purchasely.userLogin("123456789") { refresh ->
if (refresh) {
//you can call your backend to refresh user information
}
}Purchasely.userLogin("123456789", refresh -> {
if(refresh) {
//you can call your backend to refresh user information
}
return null;
});Purchasely.userLogin('123456789').then((refresh) => {
if (refresh) {
//call your backend to refresh user information
}
});Purchasely.userLogin("123456789");Sync your purchases (Android only)
Last updated