介绍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:初始化时修改了服务器环境,需要使用线上环境[accountSDK setTaeSDKEnvironment:TaeSDKEnvironmentRelease];

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

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

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