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. hadoop 完全分布式 下 datanode无法启动解决方法

    问题描述: 在集群模式下更改节点后,启动集群发现 datanode一直启动不起来. 我集群配置:有5个节点,分别为master slave1-5 . 在master以Hadoop用户执行:start- ...

  2. 利用外部表查询alert日志中的ora错误

    SQL> show parameter dump NAME                                 TYPE        VALUE------------------ ...

  3. 为tomcat动态添加jndi数据源信息

    我们在开发项目的时候,总要和数据库打交道,如何获取数据源,以什么样的方式来获取,成为了我们即简单又熟悉而且不得不注意的一个问题. 那么在这里我说三种获取数据源的常用方式: 一.通过配置文件来获取 首先 ...

  4. 3.2 ARM指令分类学习

    1 算术移位寄存器和逻辑指令 1.1 mov 传送(Move) Mov {条件} {S} <dest>, <op_1> MOV从另一个寄存器.被移位的寄存器.或者一个立即数装载 ...

  5. 微信小程序--摸索之旅

    首先 奉上腾讯官方文档 方便参考:https://mp.weixin.qq.com/debug/wxadoc/design/index.html  个人认为没说啥特别有用的信息(可能是我看的太粗糙了) ...

  6. tomcat出现的PermGen Space问题

    java.lang.OutOfmemoryError: PermGen Space 的错误,导致项目无法正常运行. 出现这个错误的原因,总结一下: PermGen Space指的是内存的永久保存区,该 ...

  7. leetcode-【hard】273. Integer to English Words

    题目: 273. Integer to English Words Convert a non-negative integer to its english words representation ...

  8. nodeJs 模块cookie-session api文档中文翻译,偶自己翻译的

    原文英文文档链接点击 说明 简单的 基于cookie的 session中间件 安装 它是一个可以用npm注册的node模块,可以通过npm install命令安装 npm install cookie ...

  9. 在PHP中使用CURL

    转载自:http://www.phpchina.com/article-40161-1.html

  10. Linux下apache+phppgadmin+postgresql安装配置

    Linux下apache+phppgadmin+postgresql安装配置 操作系统:CentOS 安装包:httpd(首选yum), php(包括php以及php-pgsql,php-mbstri ...