介绍iOS自有App开发过程中的常见问题以及解决方法。

Q:用户退出登录后,再次登录,无法获取到新的token

A:请确保退出登录时,调用了退出登录API。

#import <IMSAccount/IMSAccountService.h>
[[IMSAccountService sharedService] logout];

Q:自有App调用内置账号登录时,返回以下错误

15:48:04.904551+0800 pelfinpet[40548:1992573] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'

A:xib位置不正确,需要将ALBBOpenAccountUI.framework中的xib放置到主工程目录下。

Q:iOS自有App启动后,日志打印如下错误

出现类似“IMSPackage - AKOPModuleUpdater.m:204 | 解压出错”的内容。

2019-01-28 16:33:15.165915+0800 com.hnzhzn.zhzj[4107:1483985] IMSPackage - AKOPModuleUpdater.m:166 | 解压Zip包:E7142E1B4BEF6E7D58126924D787701F-release-a123N7GcC7vD4dFH-boneMobile-1.0.4-fdde7a3d0576b493b04b0d5ec83d79c3-source2019-01-28 16:33:15.209104+0800 com.hnzhzn.zhzj[4107:1483985] 1 entries in the zip file2019-01-28 16:33:15.210651+0800 com.hnzhzn.zhzj[4107:1483985] IMSPackage - AKOPModuleUpdater.m:204 | 解压出错:zip: /Users/zhanhe/Library/Developer/CoreSimulator/Devices/D0137B06-83AB-4EDA-818D-22E8FABF6520/data/Containers/Data/Application/D09F0B02-1891-4C5F-A76A-4E990CE41040/Library/Application Support/com.hnzhzn.zhzj/OfflinePackage/download/E7142E1B4BEF6E7D58126924D787701F-release-a123N7GcC7vD4dFH-boneMobile-1.0.4-fdde7a3d0576b493b04b0d5ec83d79c3-source.zip, dstPath: /Users/zhanhe/Library/Developer/CoreSimulator/Devices/D0137B06-83AB-4EDA-818D-22E8FABF6520/data/Containers/Data/Application/D09F0B02-1891-4C5F-A76A-4E990CE41040/Library/Application Support/com.hnzhzn.zhzj/OfflinePackage/modules/E7142E1B4BEF6E7D58126924D787701F-release-a123N7GcC7vD4dFH-boneMobile-1.0.4-fdde7a3d0576b493b04b0d5ec83d79c3-source/2.2.4, error: Error Domain=ZipArchiveBlocksErrorDomain Code=1 "Failed to open output file for writing" UserInfo={NSLocalizedDescription=Failed to open output file for writing}2019-01-28 16:33:15.210941+0800 com.hnzhzn.zhzj[4107:1483985] IMSPackage - AKOPackageUpdater.m:390 | module: E7142E1B4BEF6E7D58126924D787701F-release-a123N7GcC7vD4dFH-boneMobile-1.0.4-fdde7a3d0576b493b04b0d5ec83d79c3-source, error: Error Domain=ZipArchiveBlocksErrorDomain Code=1 "Failed to open output file for writing" UserInfo={NSLocalizedDescription=Failed to open output file for writing}2019-01-28 16:33:15.211685+0800 com.hnzhzn.zhzj[4107:1482908] IMSPackage - AKOPackageUpdater.m:407 | 结束更新任务链: {"E7142E1B4BEF6E7D58126924D787701F-release-a123N7GcC7vD4dFH-boneMobile-1.0.4-fdde7a3d0576b493b04b0d5ec83d79c3-source" = "<AKOModuleConfig: 0x60000102d840>";}, error: Error Domain=ZipArchiveBlocksErrorDomain Code=1 "Failed to open output file for writing" UserInfo={NSLocalizedDescription=Failed to open output file for writing}20          

A:用户本地使用了ZipArchive类似的库,例如当前客户使用的- SSZipArchive (= 2.1.2)和我们提供的ZipArchive发生冲突,此时需要将- SSZipArchive (= 2.1.2)删除。

Q:三方自有账号登录返回403错误,类似日志如下

<NSHTTPURLResponse: 0x600001b7a560> { URL: https://sdk.openaccount.aliyun.com/api/test/loginbyoauth.json } { Status Code: 403, Headers {
    "Access-Control-Allow-Origin" =     (
        "*"
    );
    "Content-Length" =     (
        0
    );
    "Content-Type" =     (
        "text/plain;charset=UTF-8"
    );
    Date =     (
        "Mon, 24 Jun 2019 02:42:56 GMT"
    );
    Server =     (
        nginx
    );
    "access-control-allow-headers" =     (
        "X-Requested-With,X-Sequence,X-Ca-Key,X-Ca-Secret,X-Ca-Version,X-Ca-Timestamp,X-Ca-Nonce,X-Ca-API-Key,X-Ca-Stage,X-Ca-Client-DeviceId,X-Ca-Client-AppId,X-Ca-Signature,X-Ca-Signature-Headers,X-Ca-Signature-Method,X-Forwarded-For,X-Ca-Date,X-Ca-Request-Mode,Authorization,Content-Type,Accept,Accept-Ranges,Cache-Control,Range,Content-MD5"
    );
    "access-control-allow-methods" =     (
        "GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH"
    );
    "access-control-max-age" =     (
        172800
    );
    "x-ca-error-message" =     (
        Unauthorized
    );
    "x-ca-request-id" =     (
        "2C90C481-0AEE-407B-A970-EC2259C20C5A"
    );
} }
=============================
2019-06-24 10:42:56.695167+0800 zoozee-ios[4126:434355] [Warn]
错误编码 : 554
错误类型 : ALBBOpenAccount - RPC_REQUEST_ERROR
错误消息 : 原因为Error Domain=com.alibaba.openaccount Code=552 "系统繁忙,请稍后重试" UserInfo={NSLocalizedDescription=系统繁忙,请稍后重试}
错误建议 : 请稍后重试
			

A:按照SDK的API level版本,配置以下参数。

  • API level 8及以上版本SDK:
    #import <IMSIotSmart/IMSIotSmart.h>
    
        IMSIotSmartConfig *config = [IMSIotSmartConfig new];
        config.regionType = REGION_CHINA_ONLY; //中国站;如是国际站:config.regionType = REGION_ALL; 
        config.appType  = APP_TYPE_PRODUCTION;//取值范围参见枚举类型 `IMSAppType` 
        [IMSIotSmart sharedInstance].config = config;
  • API level 7及其以下SDK版本:
    [IMSConfiguration initWithHost:@"api.link.aliyun.com" serverEnv:IMSServerRelease];//API通道SDK初始化
    [accountSDK setTaeSDKEnvironment:TaeSDKEnvironmentRelease];//账号SDK初始化

Q:在运行工程crash时会报错如下

 *** Terminating app due to uncaught exception 'com.openaccount.SecurityGuard.SECURITY_PICTURE_NOT_FOUND', reason: '(null)'

A:检查工程的bundleID与平台上创建App时输入的bundleID(包名)是否一致。

Q:iOS自有App页面上如何去掉“调试”两字

jt40
A:选择以下任一方法操作。
  • 注释掉Profied中关于IMSDebug的引用。
    pod 'IMSDebug', :path => 'LocalPods/IMSDebug.podspec' 
  • 在工程代码中搜索@"调试",注释掉代码中的相关内容。