Coder Social home page Coder Social logo

mop-ios-demo's Introduction

五行代码让你的App运行小程序

1、 修改Podfile文件,增加FinApplet依赖

source 'https://github.com/CocoaPods/Specs.git'
pod 'FinApplet'

2、初始化 SDK 五行代码完成初始化

在工程的 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;
}

3、打开小程序

NSString *appId = @"小程序id";
// 打开小程序
[[FATClient sharedClient] startRemoteApplet:appId startParams:nil InParentViewController:self completion:^(BOOL result, NSError *error) {
    NSLog(@"result:%d---error:%@", result, error);
}];
  • SDKKEYSecret 可以从免费一键部署的社区版的管理后台获取。
  • apiServer 为这里是小程序生态后端的服务地址也就是前文所输入的IP:端口
  • 小程序id 为在管理后台上架的小程序appid
  • 上述的参数可以在前文服务器部署的后台界面上获取,亦可以在没有部署服务端的情况下在https://mp.finogeeks.com快速注册,免费获取。
  • 具体的操作方法请参考 iOS集成

mop-ios-demo's People

Contributors

sybarisdev avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.