APP 每次启动的入口都是通过:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

如果是用户自己启动的 launchOptions 是不带参数的,反之者有内容.

若是外部启动launchOptions KEY 一般有:

UIApplicationLaunchOptionsURLKey //通过openURL: 启动

UIApplicationLaunchOptionsSourceApplicationKey //应用程序的bundle ID

UIApplicationLaunchOptionsRemoteNotificationKey //远程通知启动

UIApplicationLaunchOptionsLocalNotificationKey //本地通知启动

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{     NSDictionary *userInfo = [launchOptions valueForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];
    NSDictionary *apsInfo = [userInfo objectForKey:@"aps"];     if(apsInfo) {
       
      NSlog(@"%@",
apsInfo);
        return YES;
    }
    return YES;
}

一般 在APP 启动的时候会做激活网络、设置导航栏、注册用户代理、判断是否首次登录、启动动画

激活网络:

[[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];

[[AFNetworkReachabilityManager sharedManager] startMonitoring];
设置导航栏:
  

//barItem背景颜色

[[UINavigationBar appearance] setBarTintColor:[UIColor hex:@"#222028"]];

//返回按钮颜色

[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

[[UINavigationBar appearance] setTitleTextAttributes:@{

NSForegroundColorAttributeName:[UIColor whiteColor]

}

];

注册用户代理:

#import "sys/utsname.h"

- (void)registerUserAgent{

//区分客户端访问类型 是否是IOS、Android、Web端

struct utsname systemInfo;

uname(&systemInfo);

NSString *deviceString = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];

NSString *userAgent = [NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleIdentifierKey], (__bridge id)CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleVersionKey) ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleVersionKey], deviceString, [[UIDevice currentDevice] systemVersion], ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] ? [[UIScreen mainScreen] scale] : 1.0f)];

NSDictionary *dictionary = @{@"UserAgent" : userAgent};//User-Agent

[[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];

/*

UIWebView* tempWebView = [[UIWebView alloc] initWithFrame:CGRectZero];

NSString* userAgent = [tempWebView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];

//        NSLog(@"------%@",userAgent);

NSString *executableFile = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey];

NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey];

NSString *ua = [NSString stringWithFormat:@"%@ %@/%@", userAgent, executableFile,version];

//        NSLog(@"------%@",ua);

[[NSUserDefaults standardUserDefaults] registerDefaults:@{@"UserAgent" : ua, @"User-Agent" : ua}];

NSLog(@"%@ ",ua);

*/

}

判断是否首次登录:
  

if ([Login isLogin]) {

[self setupTabViewController];

}else{

[UIApplication sharedApplication].applicationIconBadgeNumber = 0;

[self setupIntroductionViewController];

}

启动动画:

  

@weakify(self);

[startView startAnimationWithCompletionBlock:^(EaseStartView *easeStartView) {

@strongify(self);

//启动动画完成后 做注册推送、注册统计、推送反馈

[self completionStartAnimationWithOptions:launchOptions];

}];

IOS (APP 启动 相应处理)的更多相关文章

  1. 马蜂窝 iOS App 启动治理:回归用户体验

    增长.活跃.留存是移动 App 的常见核心指标,直接反映一款 App 甚至一个互联网公司运行的健康程度和发展动能.启动流程的体验决定了用户的第一印象,在一定程度上影响了用户活跃度和留存率.因此,确保启 ...

  2. iOS App 启动性能优化

    1. App启动过程 解析Info.plist 加载相关信息,例如如闪屏 沙箱建立.权限检查 Mach-O加载 如果是胖二进制文件,寻找合适当前CPU类别的部分 加载所有依赖的Mach-O文件(递归调 ...

  3. appium + java + WebDriverAgent实现IOS app启动

    Appium v1.8.1 <dependency>    <groupId>io.appium</groupId>    <artifactId>ja ...

  4. iOS App启动图不显示的解决办法.

    1. 正常来说,启动图以及App图标需按照命名规则命名, 但是命名不规范并不影响显示; 2. 设置启动图的两种方法:      (1) iOS 8—xcode 6 之后新出LaunchScreen.s ...

  5. iOS app启动流程

    最近看了些Runtime Runloop的一些知识.边看边摸索.看到群里有人在问 一些面试题.其中就提到了app的启动流程. 所以这里也研究小结一下,以供自己学习备用. 1.项目要运行,就要有入口. ...

  6. IOS app启动过程

    1.main函数   2.UIApplicationMain * 创建UIApplication对象 * 创建UIApplication的delegate对象   3.delegate对象开始处理(监 ...

  7. iOS开发app启动原理及视图和控制器的函数调用顺序

    main()函数是整个程序的入口,在程序启动之前,系统会调用exec()函数.在Unix中exec和system的不同在于,system是用shell来调用程序,相当于fork+exec+waitpi ...

  8. iOS App从点击到启动

    程序启动之前 从exec()开始 main()函数是整个程序的入口,在程序启动之前,系统会调用exec()函数.在Unix中exec和system的不同在于,system是用shell来调用程序,相当 ...

  9. ios UIApplocation 中APP启动方式

    iOS app启动的方式有哪些: 自己启动(用户手动点击启动) urlscheme启动(关于urlScheme的详解)http://www.cnblogs.com/sunfuyou/p/6183064 ...

随机推荐

  1. EF执行SQL

    1.EntityFramework 执行SQL语句进行参数化查询代码示例 参考:http://blog.csdn.net/chz_cslg/article/details/49002093

  2. (Skill)238. Product of Array Except Self

    Given an array of n integers where n > 1, nums, return an array output such that output[i] is equ ...

  3. VS2010中的查找和替换中正则的使用

    只是记下来怕以后忘记了: 查找:/news/(\d+).html 要匹配(\d+),记得用括号 替换为:/NewsDetails.aspx?id=$1 $1表示匹配的结果

  4. Crypto++ RSA从字符串读取公私匙

    string and StringSource (load): string spki = ...; StringSource ss(spki, true /*pumpAll*/); RSA::Pub ...

  5. iPhone与iPad在开发上的区别

    *:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...

  6. VBA_Excel_教程:单元格颜色

    Sub SetCellColor() '设置单元格颜色 Sheet1.Cells(, ).Interior.ColorIndex = End Sub

  7. GPUImage实现摄像头暂停

    GPUImage相信很多开发者都用过,其本身也是十分简单易用,因此对于GPUImage的基本用法不再赘述. 最近在使用GPUImage时要实现摄像时暂停和继续的功能,但GPUImage本身并没有提供相 ...

  8. iconfont 图标字体

    iconfont 技术的主要是将图标转化为字体来减少应用体积.如需在项目中使用iconfont技术,图标矢量图一开始都应合并转化为字体库.   优点: 减小体积,字体文件比图片要小 图标保真缩放,解决 ...

  9. Eclipse使用tomcat的原理

    1. 当我们使用Eclipse将项目部署到Tomcat的时,我们发现,在Tomcat下的webapps目录下并没有我们创建好的项目,但是当通过Eclipse启动服务器后,项目却真的可以访问到,这是为什 ...

  10. 表中排序ID断开重排

    客户需要排序ID和页面的问题序号一致,以前删除过一些问题导致order_id 中间有些断开的. 业务表 T_QUESTION order_id question_id  custom_id --1.创 ...