iOS

SDK接入指南

引入SDK

GitHub仓库: TP iOS SDKarrow-up-right

下载仓库中TPSDK.zip, 解压后,添加到工程目录。

  1. 设置URL scheme: Project->TARGETS->info->URL Types->添加URL scheme;

  2. info.plistLSApplicationQueriesSchemes添加一项,值为tpoutside ;

初始化

  • AppDelegate.m 中添加头文件

#import <TPSDK/TPSDK.h>
  • application:didFinishLaunchingWithOptions: 方法中注册scheme

[TPApi registerAppID:@"demoapp"];
  • application:openURL: 方法中添加监听回调方法

[TPApi handleURL:url options:options result:^(TPRespObj *respObj) {
    respObj.result;     // TPRespResultCanceled = 0,TPRespResultSuccess, TPRespResultFailure,
    respObj.message;    // Result message
    respObj.data;       // Json details
    /* Json details:
    {
        "result" : 1,
        "action" : "sign",
        "version" : "1.0",
        "protocol" : "TPProtocol",
        "ref" : "TokenPocket",
        "wallet" : "xxx...xxx",       // 成功时返回
        "publickey" : "xxx...xxx",    // 成功时返回
        "permissions" : [             // 成功时返回;  eosio/iost网络返回该字段
            "active",
            "owner"
        ],
        ...,
    }
    */
}];

支持操作

授权登录

签名

Push Transaction

代码示例

授权登录

签名

Push Transaction

EthGetEncryptionPublicKey

EthDecrypt

Last updated