You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.6 KiB

4 years ago
#import "AppDelegate.h"
#import "GeneratedPluginRegistrant.h"
#import <AMapFoundationKit/AMapFoundationKit.h>
#import "DCUniMP.h"
4 years ago
#import "MinPlugin.h"
4 years ago
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch.
4 years ago
// [GeneratedPluginRegistrant registerWithRegistry:[[MinPlugin alloc] init]];
// 配置参数
NSMutableDictionary *options = [NSMutableDictionary dictionaryWithDictionary:launchOptions];
// 设置 debug YES 会在控制台输出 js log,默认不输出 log,注:需要引入 liblibLog.a
[options setObject:[NSNumber numberWithBool:YES] forKey:@"debug"];
[DCUniMPSDKEngine initSDKEnvironmentWithLaunchOptions:options];
// test
FlutterViewController* controller = (FlutterViewController*)self.window.rootViewController;
FlutterMethodChannel* uniAppChannel = [FlutterMethodChannel methodChannelWithName:@"zsw" binaryMessenger:controller];
MinPlugin * plugin = [[MinPlugin alloc] init];
[DCUniMPSDKEngine setDelegate:plugin];
[uniAppChannel setMethodCallHandler:^(FlutterMethodCall * _Nonnull call, FlutterResult _Nonnull result) {
NSLog(@"arg:%@",call.arguments);
if ([call.method isEqual:@"open"]){
[plugin open:call.arguments[0] url:call.arguments[1] param:call.arguments[2] block:nil];
} else if ([call.method isEqual:@"openUniApp"]) {
NSDictionary * dict = @{@"token":call.arguments[0],@"storeId":@""};
[plugin openUniApp:call.arguments[0] dict:dict];
4 years ago
}else{
4 years ago
result(FlutterMethodNotImplemented);
}
}];
// 小程序
4 years ago
[AMapServices.sharedServices setApiKey:@"feaae7986201b571cace1b83728be5bb"];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
#pragma mark - App 生命周期方法
- (void)applicationDidBecomeActive:(UIApplication *)application {
[DCUniMPSDKEngine applicationDidBecomeActive:application];
}
- (void)applicationWillResignActive:(UIApplication *)application {
[DCUniMPSDKEngine applicationWillResignActive:application];
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
[DCUniMPSDKEngine applicationDidEnterBackground:application];
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
[DCUniMPSDKEngine applicationWillEnterForeground:application];
}
- (void)applicationWillTerminate:(UIApplication *)application {
[DCUniMPSDKEngine destory];
}
@end