1.新建工程
在XCODE中新建你的工程,支持的最低iOS版本为iOS 8,iOS10+ 在项目设置中打开Keychain sharing;
2.引入华瑞开放平台
将华瑞开放平台iOS SDK中包含的HRSDK文件夹内的所有文件拖入到工程内;
如果需要引入融资模块,请另外下载包含有融资模块的HRSDK,将此包里的文件引入工程;
此外包含融资模块的SDK,只支持真机模式
3.添加依赖库
在Linked Frameworks and Libraries中引入
如果引入了HRSDK的融资模块的,请按照“6.融资模块需额外配置”对工程进行额外配置
4.出于安全性控制,我们在key chain中记录了设备ID等信息,请XCODE8以上的开发者打开key chain权限;
5.修改build setting
添加other linker flags属性:$(OTHER_LDFLAGS) -ObjC
如果引入了HRSDK的融资模块的,请按照“6.融资模块需额外配置”对工程进行额外配置
6.融资模块需额外配置
如果接入融资模块,请按照截图配置工程
7.SDK半屏设置
由于SDK内有的页面属于半屏页面,所以需要一个继承UIViewControllerTransitioningDelegate的ViewController,会从此viewController present出支付页面,融资页面等,请在此view Controller中实现如下方法:
- (UIPresentationController *)
presentationControllerForPresentedViewController:
(UIViewController *)presented
presentingViewController:
(UIViewController *)presenting
sourceViewController:
(UIViewController *)source{
return
[[HRCustomPresentationVc alloc]
initWithPresentedViewController:presented
presentingViewController:presenting];
}
8.引入头文件
在需要使用华瑞开放平台SDK的文件中#import "HRSDK.h"
、#import "HRCustomPresentationVC.h"
、#import "HRCallBackModel.h"
并遵守协议<HRRespDelegate>、<UIViewControllerTransitioningDelegate>
。若使用到支付,请import支付的model,#import "HRPaymentInfo.h"
。若使用到申购投资理财,请import申购投资理财的model,#import "HRPurchaseInfo.h"
#import "HRSDK.h"
#import "HRCallBackModel.h"
#import "HRPaymentInfo.h"
#import "HRCustomPresentationVC"
@interface ViewController : UIViewController<HRRespDelegate,UIViewControllerTransitioningDelegate>