100 lines
3.2 KiB
Objective-C
100 lines
3.2 KiB
Objective-C
//
|
||
// AppDelegate.m
|
||
// ProductApp
|
||
//
|
||
// Created by yx_macmini on 2021/11/17.
|
||
//
|
||
|
||
#import "AppDelegate.h"
|
||
#import "ViewController.h"
|
||
#import "NavgationController.h"
|
||
#import "TabBarController.h"
|
||
#import "LoginViewController.h"
|
||
|
||
|
||
#import <GeYanSdk/GeYanSdk.h>
|
||
#import <GTSDK/GeTuiSdk.h>
|
||
#import <GTCommonSDK/GTCommonSDK.h>
|
||
|
||
@interface AppDelegate ()
|
||
|
||
@end
|
||
|
||
@implementation AppDelegate
|
||
|
||
/// 在这里写支持的旋转方向,为了防止横屏方向,应用启动时候界面变为横屏模式
|
||
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
|
||
// return UIInterfaceOrientationMaskLandscapeRight;///启动就横屏
|
||
// // 可以这么写
|
||
// if (self.allowOrentitaionRotation) {
|
||
// return UIInterfaceOrientationMaskAllButUpsideDown;
|
||
// }
|
||
return UIInterfaceOrientationMaskPortrait;
|
||
}
|
||
|
||
|
||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||
self.window.backgroundColor = [UIColor whiteColor];
|
||
|
||
[self.window setRootViewController:[TabBarController new]];
|
||
|
||
// [self.window setRootViewController:[[NavgationController alloc] initWithRootViewController:[LoginViewController new]]];
|
||
|
||
[self.window makeKeyAndVisible];
|
||
|
||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||
// [self getTuiSheZhi:launchOptions];
|
||
});
|
||
|
||
///禁止黑暗模式
|
||
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
|
||
if(@available(iOS 13.0,*)){
|
||
self.window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
|
||
}
|
||
#endif
|
||
|
||
return YES;
|
||
}
|
||
|
||
-(void)getTuiSheZhi:(NSDictionary *)launchOptions
|
||
{
|
||
dispatch_async(dispatch_get_main_queue(), ^{
|
||
//超时设置,建议为8s以上,至少5s以上;
|
||
[GeYanSdk setPreLoginTimeout:10]; //预登录超时时长
|
||
[GeYanSdk setEloginTimeout:10]; //登录超时时长
|
||
// NSLog(@"pgj = %@",[GeYanSdk getVersion]);
|
||
//初始化
|
||
[GeYanSdk startWithAppId:GeTuiAPPID
|
||
withCallback:^(BOOL isSuccess, NSError *error, NSString *gtcid) {
|
||
NSLog(@"GeYanSdk startWithAppId gtcid:%@", gtcid);
|
||
}];
|
||
|
||
//提前进行预登录,以便节省后续用户的等待时间;
|
||
[GeYanSdk preGetToken:^(NSDictionary *preDic) {
|
||
NSLog(@"preGetToken:%@", preDic);
|
||
}];
|
||
|
||
// //推送
|
||
// // 通过个推平台分配的appId、 appKey 、appSecret 启动SDK,注:该方法需要在主线程中调用
|
||
// [GeTuiSdk startSdkWithAppId:kGtAppId appKey:kGtAppKey appSecret:kGtAppSecret delegate:self launchingOptions:launchOptions];
|
||
//
|
||
// // 注册远程通知
|
||
// [GeTuiSdk registerRemoteNotification: (UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge)];
|
||
|
||
});
|
||
}
|
||
|
||
- (void)applicationDidBecomeActive:(UIApplication *)application
|
||
{
|
||
///
|
||
[[NSNotificationCenter defaultCenter] postNotificationName:@"huoquidfanotifi" object:nil];
|
||
}
|
||
- (void)applicationWillResignActive:(UIApplication *)application
|
||
{
|
||
|
||
}
|
||
|
||
|
||
@end
|