// // AppDelegate.m // screendisplay // // Created by 单军华 on 2018/6/29. // Copyright © 2018年 单军华. All rights reserved. // #import "AppDelegate.h" #import "LMJTabBarController.h" #import "LMJIntroductoryPagesHelper.h" #import "AdvertiseHelper.h" #import "YYFPSLabel.h" #import "LoginViewController.h" #import "MonitoringMapViewController.h" #import "DetailDataViewController.h" #import "CommonReqModel.h" @interface AppDelegate () { BMKMapManager* _mapManager; } @end @implementation AppDelegate + (AppDelegate *)AppInstance; { return (AppDelegate *)[UIApplication sharedApplication].delegate; } - (void)showHomePage { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.window.backgroundColor = [UIColor clearColor]; LMJTabBarController *root = [[LMJTabBarController alloc]init]; UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:root];//先将root添加在navigation上 nav.navigationBarHidden = YES; [self.window setRootViewController:nav];//navigation加在window上 [self.window makeKeyAndVisible]; } - (void)showLoginPage { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.window.backgroundColor = [UIColor clearColor]; LoginViewController *root = [[LoginViewController alloc]init]; UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:root];//先将root添加在navigation上 nav.navigationBarHidden = YES; [self.window setRootViewController:nav];//navigation加在window上 [self.window makeKeyAndVisible]; } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. //self.window.rootViewController = [[LMJTabBarController alloc] init]; // 欢迎视图 //[LMJIntroductoryPagesHelper showIntroductoryPageView:@[@"intro_0", @"intro_1", @"intro_2", @"intro_3"]]; // NSArray *imagesURLS = @[@"https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=4137683290,3868858004&fm=15&gp=0.jpg", @"https://、、ss2.bdstati c.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=4137683290,3868858004&fm=15&gp=0.jpg"]; // // // 启动广告 // [AdvertiseHelper showAdvertiserView:imagesURLS]; // // // 刷新率 // [self.window addSubview:[[YYFPSLabel alloc] initWithFrame:CGRectMake(20, 70, 0, 0)]]; // 要使用百度地图,请先启动BaiduMapManager _mapManager = [[BMKMapManager alloc]init]; /** *百度地图SDK所有接口均支持百度坐标(BD09)和国测局坐标(GCJ02),用此方法设置您使用的坐标类型. *默认是BD09(BMK_COORDTYPE_BD09LL)坐标. *如果需要使用GCJ02坐标,需要设置CoordinateType为:BMK_COORDTYPE_COMMON. */ if ([BMKMapManager setCoordinateTypeUsedInBaiduMapSDK:BMK_COORDTYPE_BD09LL]) { NSLog(@"经纬度类型设置成功"); } else { NSLog(@"经纬度类型设置失败"); } BOOL ret = [_mapManager start:@"PGtisoyeerNjiDtFZou4oUhQurGiaaPN" generalDelegate:self]; if (!ret) { NSLog(@"manager start failed!"); } [self showLoginPage]; //异常对象:NSException //参数:将函数的地址给它 NSSetUncaughtExceptionHandler(&getException); return YES; } - (void)applicationWillResignActive:(UIApplication *)application { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. } - (void)applicationDidEnterBackground:(UIApplication *)application { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - (void)applicationWillEnterForeground:(UIApplication *)application { // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } - (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - (void)applicationWillTerminate:(UIApplication *)application { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } - (void)onGetNetworkState:(int)iError { if (0 == iError) { NSLog(@"联网成功"); } else{ NSLog(@"onGetNetworkState %d",iError); } } - (void)onGetPermissionState:(int)iError { if (0 == iError) { NSLog(@"授权成功"); } else { NSLog(@"onGetPermissionState %d",iError); } } //获得异常的C函数 void getException(NSException *exception) { NSLog(@"名字:%@",exception.name); NSLog(@"原因:%@",exception.reason); NSLog(@"用户信息:%@",exception.userInfo); NSLog(@"栈内存地址:%@",exception.callStackReturnAddresses); NSLog(@"栈描述:%@",exception.callStackSymbols); //每次启动的时候将,捕获的异常信息,反馈给服务器 //获取当前设备 UIDevice*divice=[UIDevice currentDevice]; //1.系统版本 NSString*systemVersion=divice.systemVersion; //2.app当前版本 //先获取当前infoplist文件数据 NSDictionary*infoDic=[[NSBundle mainBundle] infoDictionary]; //然后从字典中取出版本号 NSString*version=[infoDic objectForKey:@"CFBundleShortVersionString"]; NSLog(@"系统版本%@",version); //3.系统时间 NSDate*date=[NSDate date]; //4.设备种类 NSString*model=divice.model; //将捕获的异常数据进行保存,保存到本地 //可以在下一次启动的时候将数据发给服务器 } @end