mechId
和 p12文件无论以何种方式安装SDK,都需要联系开发拿到
商户ID
和p12文件
及p12密码
,将p12文件
添加到项目目录中。
CECreditReport-master
压缩文件;CECreditReport
文件夹下的 CECreditReportManager.h
、libCECreditReportSDK.a
和 Resource.bundle
添加到您的 iOS 工程中
;提醒:请记得勾选 "Copy items if needed"。
1. 在链接设置中,在 Other Linker Flags 中添加 -all_load 参数,请注意大小写。
2. 在 Info.plist 文件中添加: <key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
提醒:链接设置位于项目设置 target -> 选项卡 Build Settings,左上角选择 All。
CECreditReportManager *creditReportManager = [CECreditReportManager sharedInstance];
creditReportManager.rootViewController = self;
creditReportManager.userId = @"xxxxxxxxxx";
creditReportManager.merchId = @"xxxxxxxxx";
//*** 必须生成私钥请查看RSA密码生成说明文件 ***//
creditReportManager.p12Path = [[NSBundle mainBundle] pathForResource:@"private_key" ofType:@"p12"]
creditReportManager.p12Password = @"xxxxxxx";
//*** 可自定义导航栏背景色和导航栏title样式***//
[CECreditReportManager sharedInstance].navigationBackgroundColor = [UIColor blueColor];
[CECreditReportManager sharedInstance].navigationTitleAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:18],NSForegroundColorAttributeName:[UIColor colorWithRed:1 green:0 blue:0 alpha:0]};
__weak typeof(self) weakSelf = self;
creditReportManager.dismissBlock = ^(){
__strong typeof(weakSelf) strongSelf = weakSelf;
//*** 可选, 征信退出后,处理适配操作,比如导航栏、状态栏等. ***//
};
[creditReportManager startGetCRP];
属性 | 是否必须 | 描述 |
---|---|---|
rootViewController | 是 | 设置 rootViewController ,通过 present 方式展示征信报告视图 |
userId | 是 | 唯一标识 用户ID |
merchId | 是 | 商户ID |
p12Path | 是 | 私钥本地路径 |
p12Password | 是 | 私钥密码 |
navigationBackgroundColor | 否 | 设置导航栏背景色,默认蓝色。如果设置为白色,需要更换 Resource 内 “nv_back” 图片资源 |
navigationTitleAttributes | 否 | 设置导航栏 title 样式,默认 18 号字,白色 |
查看并运行 CECreditReportDemo/CECreditReportDemo.xcodeproj
,效果如下。
此 SDK 需要 iOS 7.0+
和 Xcode 7.0+
。
使用 MIT 许可证,详细信息请参阅 LICENSE 文件。
如有问题请联系我([email protected])