介紹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' 
  • 在工程代碼中搜索@"調試",注釋掉代碼中的相關內容。