phizclip-ios-demo/README.md

43 lines
1.5 KiB
Objective-C
Raw Normal View History

2020-03-15 19:21:56 +08:00
# 五行代码让你的App运行小程序
2020-03-15 19:18:44 +08:00
2020-03-15 19:21:56 +08:00
## 1、 修改Podfile文件增加FinApplet依赖
2020-03-15 19:18:44 +08:00
```
source 'https://github.com/CocoaPods/Specs.git'
pod 'FinApplet'
```
2020-03-15 19:21:56 +08:00
## 2、初始化 SDK **五行代码完成初始化**
2020-03-15 19:18:44 +08:00
AppDelegate SDK
```
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSString *appKey = @"SDKKEY";
FATConfig *config = [FATConfig configWithAppSecret:@"SECRET" appKey:appKey];
config.apiServer = @"https://mp.finogeeks.com";
config.apiPrefix = @"/api/v1/mop";
[[FATClient sharedClient] initWithConfig:config error:nil];
return YES;
}
```
2020-03-15 19:21:56 +08:00
## 3、打开小程序
2020-03-15 19:18:44 +08:00
```
NSString *appId = @"小程序id";
// 打开小程序
[[FATClient sharedClient] startRemoteApplet:appId startParams:nil InParentViewController:self completion:^(BOOL result, NSError *error) {
NSLog(@"result:%d---error:%@", result, error);
}];
```
* **SDKKEY** **Secret**
* **apiServer** **IP:**
* **id** appid
* [https://mp.finogeeks.com](https://mp.finogeeks.com)快速注册,免费获取。
* [iOS](https://mp.finogeeks.com/mop/document/runtime-sdk/sdk-integrate/ios.html)