当您开发自有App,下载并集成SDK后,需要对所有SDK进行初始化。本文介绍如何初始化客户端iOS SDK。
操作步骤
- 重要
请勿修改安全图片名称,下载后直接拷贝到App工程目录下。
初始化SDK。
启动初始化。
#import <IMSIotSmart/IMSIotSmart.h> - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { IMSIotSmartConfig *config = [IMSIotSmartConfig new]; config.regionType = REGION_ALL; config.appType = APP_TYPE_PRODUCTION; [[IMSIotSmart sharedInstance] setConfig:config]; [[IMSIotSmart sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; [ALBBOpenAccountUIManager sharedInstance].loadNibBundle = [NSBundle mainBundle]; return YES; } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { //如果App没有集成移动应用推送能力,此处无需要调用 [[IMSIotSmart sharedInstance] application:application didReceiveRemoteNotification:userInfo]; } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { //如果App没有集成移动应用推送能力,此处无需要调用 [[IMSIotSmart sharedInstance] application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { //如果App没有集成移动应用推送能力,此处无需要调用 [[IMSIotSmart sharedInstance] application:application didFailToRegisterForRemoteNotificationsWithError:error]; }
设置App可配网的产品列表。
#import <IMSIotSmart/IMSIotSmart+scope.h> [[IMSIotSmart sharedInstance] configProductScope:PRODUCT_SCOPE_ALL]; /// 配置App上能看到的产品的范围,PRODUCT_SCOPE_ALL:表示当前项目中已发布和未发布的所有产品;PRODUCT_SCOPE_PUBLISHED:表示只包含已发布产 /// 正式发布的App请选择PRODUCT_SCOPE_PUBLISHED
文档内容是否对您有帮助?