UIKit_UIApplication

参考: http://www.cnblogs.com/wendingding/p/3766347.html



一、UIApplication

1、简单介绍

(1)UIApplication对象代表一个应用程序,继承自UIResponder。

(2)通过 [UIApplication sharedApplication] 获得这个单例对象

(3)一个应用程序启动后创建的第一个对象,且唯一

(4)使用UIApplication对象,进行应用级别操作

(5)UIApplication对象

@interface UIApplication : UIResponder


@interface UIApplication (UIRemoteNotifications)  (远程通知,推送)

@interface UIApplication (UILocalNotifications) (本地通知)

@interface UIApplication (UIUserNotificationSettings)

@interface UIApplication (UIRemoteControlEvents)

@interface UIApplication (UINewsstand)

@interface UIApplication (UIShortcutItems)

@interface UIApplication (UIStateRestoration)

@interface UIApplication(UIApplicationDeprecated)

     


2、操作实例:

(1)openURL:方法

//打电话

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://10086"]];

    //发短信

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://10086"]];

    //发邮件

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://12345@qq.com"]];

    //打开网页

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.baidu.com"]];

    //打开其他app

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"itms-apps://itunes.apple.com/us/app/id%@?mt=8",@"appid"]]];


_____________________________________________________________________________

NS_CLASS_AVAILABLE_IOS(2_0) @interface UIApplication : UIResponder


#if UIKIT_DEFINE_AS_PROPERTIES

@property(class, nonatomic, readonly) UIApplication *sharedApplication ;

#else

+ (UIApplication *)sharedApplication;

#endif


@property(nullable, nonatomic, assign) id<UIApplicationDelegate> delegate;


//开始禁止交互 (比如动画进行时)

- (void)beginIgnoringInteractionEvents;

//结束禁止交互

- (void)endIgnoringInteractionEvents;

#if UIKIT_DEFINE_AS_PROPERTIES

//是否禁止了交互

@property(nonatomic, readonly, getter=isIgnoringInteractionEvents) BOOL ignoringInteractionEvents;                  

#else

- (BOOL)isIgnoringInteractionEvents;                  

#endif



//防止锁屏,游戏视频等

@property(nonatomic,getter=isIdleTimerDisabled)       BOOL idleTimerDisabled;   // default is NO



//打开url

- (BOOL)openURL:(NSURL*)url NS_DEPRECATED_IOS(2_0, 10_0, "Please use openURL:options:completionHandler: instead") NS_EXTENSION_UNAVAILABLE_IOS("");

//检测能否打开url,可以检测是否安装了某个应用

- (BOOL)canOpenURL:(NSURL *)url NS_AVAILABLE_IOS(3_0);

//options没有限定值时传空字典@{}, @{UIApplicationOpenURLOptionUniversalLinksOnly : @YES} ,详解http://blog.csdn.net/hurricane_eye/article/details/52673232

- (void)openURL:(NSURL*)url options:(NSDictionary<NSString *, id> *)options completionHandler:(void (^ __nullable)(BOOL success))completion;



//重写可拦截事件, 详解http://blog.csdn.net/sakulafly/article/details/18792631

- (void)sendEvent:(UIEvent *)event;


@property(nullable, nonatomic,readonly) UIWindow *keyWindow;

@property(nonatomic,readonly) NSArray<__kindof UIWindow *>  *windows;


- (BOOL)sendAction:(SEL)action to:(nullable id)target from:(nullable id)sender forEvent:(nullable UIEvent *)event;



//左上角,网络请求菊花转动

@property(nonatomic,getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible __TVOS_PROHIBITED

//状态栏颜色样式

@property(readonly, nonatomic) UIStatusBarStyle statusBarStyle __TVOS_PROHIBITED

//隐藏状态栏

@property(readonly, nonatomic,getter=isStatusBarHidden) BOOL statusBarHidden __TVOS_PROHIBITED;

//状态方向,iPad转屏

@property(readonly, nonatomic) UIInterfaceOrientation statusBarOrientation __TVOS_PROHIBITED;

//支持的UIInterfaceOrientation (iPad或全屏播放视频多会 UIInterfaceOrientationMaskAll)

- (UIInterfaceOrientationMask)supportedInterfaceOrientationsForWindow:(nullable UIWindow *)window NS_AVAILABLE_IOS(6_0) __TVOS_PROHIBITED;

//返回90度转屏状态栏的动画持续时间, 180度转屏时间加倍

@property(nonatomic,readonly) NSTimeInterval statusBarOrientationAnimationDuration __TVOS_PROHIBITED

//状态栏frame, 隐藏返回CGRectZero

@property(nonatomic,readonly) CGRect statusBarFrame __TVOS_PROHIBITED



//桌面app图标上消息数量提示, 默认0不显示(iOS8,要先注册用户通知)

@property(nonatomic) NSInteger applicationIconBadgeNumber;  

//支持手机摇动

@property(nonatomic) BOOL applicationSupportsShakeToEdit NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED;



//后台运行相关 http://blog.csdn.net/lengshengren/article/details/19077645

//程序运行状态

@property(nonatomic,readonly) UIApplicationState applicationState NS_AVAILABLE_IOS(4_0);

//iOS被要求在程序被完全挂起之前给于更多的执行时间,这个属性指明了在完成任务前程序拥有多少秒

@property(nonatomic,readonly) NSTimeInterval backgroundTimeRemaining NS_AVAILABLE_IOS(4_0);

//在后台完成一个长期的任务,调用此方法, 同时必须相应的调用endBackgroundTask

- (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:(void(^ __nullable)(void))handler;

- (UIBackgroundTaskIdentifier)beginBackgroundTaskWithName:(nullable NSString *)taskName expirationHandler:(void(^ __nullable)(void))handler;

- (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifier NS_AVAILABLE_IOS(4_0) NS_REQUIRES_SUPER;

//程序在后台被定期唤醒

- (void)setMinimumBackgroundFetchInterval:(NSTimeInterval)minimumBackgroundFetchInterval NS_AVAILABLE_IOS(7_0) __TVOS_PROHIBITED;

//后台刷新状态

@property (nonatomic, readonly) UIBackgroundRefreshStatus backgroundRefreshStatus NS_AVAILABLE_IOS(7_0) __TVOS_PROHIBITED;

//加密是否有效

@property(nonatomic,readonly,getter=isProtectedDataAvailable) BOOL protectedDataAvailable NS_AVAILABLE_IOS(4_0);

//屏幕方向

@property(nonatomic,readonly) UIUserInterfaceLayoutDirection userInterfaceLayoutDirection NS_AVAILABLE_IOS(5_0);

// Return the size category

@property(nonatomic,readonly) UIContentSizeCategory preferredContentSizeCategory NS_AVAILABLE_IOS(7_0);


@end







___________________________________

@interface UIApplication (UIRemoteNotifications)   (远程通知,推送)


// 注册RemoteNotification的类型

- (void)registerForRemoteNotifications NS_AVAILABLE_IOS(8_0);



/** 解除RemoteNotification的注册(关闭消息推送,实际调用:[[UIApplication sharedApplication] unregisterForRemoteNotifications]

 @param types 消息类型,参见`UIRemoteNotificationType`

 */

- (void)unregisterForRemoteNotifications NS_AVAILABLE_IOS(3_0);



// Returns YES if the application is currently registered for remote notifications, taking into account any systemwide settings; doesn't relate to connectivity.

#if UIKIT_DEFINE_AS_PROPERTIES

@property(nonatomic, readonly, getter=isRegisteredForRemoteNotifications) BOOL registeredForRemoteNotifications NS_AVAILABLE_IOS(8_0);

#else

- (BOOL)isRegisteredForRemoteNotifications NS_AVAILABLE_IOS(8_0);

#endif

//iOS3~iOS8

- (void)registerForRemoteNotificationTypes:(UIRemoteNotificationType)types;


//iOS3~iOS8

- (UIRemoteNotificationType)enabledRemoteNotificationTypes;


@end


___________________________________

// In iOS 8.0 and later, your application must register for user notifications using -[UIApplication registerUserNotificationSettings:] before being able to schedule and present UILocalNotifications

@interface UIApplication (UILocalNotifications)    (本地通知)


// 立即发出本地推送通知 (创建: UILocalNotification *localNoti = [[UILocalNotification alloc] init];)

- (void)presentLocalNotificationNow:(UILocalNotification *)notification NS_DEPRECATED_IOS(4_0, 10_0, "Use UserNotifications Framework's -[UNUserNotificationCenter addNotificationRequest:withCompletionHandler:]") __TVOS_PROHIBITED;


// 调度本地推送通知(调用后,推送通知会在特地时间fireDate发出)

- (void)scheduleLocalNotification:(UILocalNotification *)notification NS_DEPRECATED_IOS(4_0, 10_0, "Use UserNotifications Framework's -[UNUserNotificationCenter addNotificationRequest:withCompletionHandler:]") __TVOS_PROHIBITED// copies notification


// 取消调用某个本地推送通知

- (void)cancelLocalNotification:(UILocalNotification *)notification NS_DEPRECATED_IOS(4_0, 10_0, "Use UserNotifications Framework's -[UNUserNotificationCenter removePendingNotificationRequestsWithIdentifiers:]") __TVOS_PROHIBITED;


// 取消调用所有本地推送通知

- (void)cancelAllLocalNotifications NS_DEPRECATED_IOS(4_0, 10_0, "Use UserNotifications Framework's -[UNUserNotificationCenter removeAllPendingNotificationRequests]") __TVOS_PROHIBITED;


// 获得被调用的所有的有效的本地推送通知  (不包括已发出的或过期的)

@property(nullable,nonatomic,copy) NSArray<UILocalNotification *> *scheduledLocalNotifications NS_DEPRECATED_IOS(4_0, 10_0, "Use UserNotifications Framework's -[UNUserNotificationCenter getPendingNotificationRequestsWithCompletionHandler:]") __TVOS_PROHIBITED;


@end

实例1:本地定时通知


___________________________________

@class UIUserNotificationSettings;

@interface UIApplication (UIUserNotificationSettings) 


//iOS8后,需要添加这个注册,

// Registering UIUserNotificationSettings more than once results in previous settings being overwritten.

- (void)registerUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings NS_AVAILABLE_IOS(8_0) __TVOS_PROHIBITED;


// Returns the enabled user notification settings, also taking into account any systemwide settings.

#if UIKIT_DEFINE_AS_PROPERTIES

//判断用户是否允许通知(iOS8)

@property(nonatomic, readonly, nullable) UIUserNotificationSettings *currentUserNotificationSettings NS_AVAILABLE_IOS(8_0) __TVOS_PROHIBITED;

#else

- (nullable UIUserNotificationSettings *)currentUserNotificationSettings NS_AVAILABLE_IOS(8_0) __TVOS_PROHIBITED;

#endif


@end


实例2:判断用户是否允许通知

- (BOOL)checkIsAllowNotification

{

    if (IsDeviceVersionIOS8) {//iOS8

        UIUserNotificationSettings *settings = [[UIApplication sharedApplication] currentUserNotificationSettings];

        if (settings.types != UIUserNotificationTypeNone) {

            return YES;

        } else {

            return NO;

        }

    } else {//iOS7

        UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];

        if (type != UIRemoteNotificationTypeNone) {

            return YES;

        } else {

            return NO;

        }

    }

}


___________________________________

@interface UIApplication (UIRemoteControlEvents) 


// 多媒体开发使用   实例地址http://blog.sina.com.cn/s/blog_468eb48e01011c6n.html  

// http://blog.csdn.net/ztp800201/article/details/9415577

- (void)beginReceivingRemoteControlEvents NS_AVAILABLE_IOS(4_0);

- (void)endReceivingRemoteControlEvents NS_AVAILABLE_IOS(4_0);


@end




___________________________________

@interface UIApplication (UINewsstand)   (报纸杂志类应用程序)

// 实例 http://blog.csdn.net/justinjing0612/article/details/33735031

- (void)setNewsstandIconImage:(nullable UIImage *)image NS_DEPRECATED_IOS(5_0, 9_0, "Newsstand apps now behave like normal apps on SpringBoard") __TVOS_PROHIBITED;

@end


___________________________________

@class UIApplicationShortcutItem;

@interface UIApplication (UIShortcutItems)  (iOS9, 3D Touch)

// Register shortcuts to display on the home screen, or retrieve currently registered shortcuts.

// 在主屏幕上显示的快捷方式,或检索当前注册的快捷方式。

@property (nullable, nonatomic, copy) NSArray<UIApplicationShortcutItem *> *shortcutItems NS_AVAILABLE_IOS(9_0) __TVOS_PROHIBITED;

@end


实例:

if (IsDeviceVersionIOS9) {

        UIApplicationShortcutIcon *icon_1 = [UIApplicationShortcutIcon iconWithTemplateImageName:@"touch_post"];

        UIApplicationShortcutItem *quickItem_1 = [[UIApplicationShortcutItem alloc] initWithType:@"1" localizedTitle:@“搜索 localizedSubtitle:nil icon:icon_1 userInfo:nil];

        

        [[UIApplication sharedApplication] setShortcutItems:@[quickItem_1]];

    }


___________________________________

@protocol UIStateRestoring;

@interface UIApplication (UIStateRestoration)   (控制状态恢复)


//异步恢复状态

- (void)extendStateRestoration  NS_AVAILABLE_IOS(6_0);

//结束异步恢复状态

- (void)completeStateRestoration  NS_AVAILABLE_IOS(6_0);


// Indicate the application should not use the snapshot on next launch, even if there is a valid state restoration archive.

// This should only be called from methods invoked from State Preservation, else it is ignored.

//阻止应用程序在下一次启动时使用快照,即使有一个有效的状态恢复归档

- (void)ignoreSnapshotOnNextApplicationLaunch NS_AVAILABLE_IOS(7_0);


// Register non-View/ViewController objects for state restoration so other objects can reference them within state restoration archives.

// If the object implements encode/decode, those methods will be called during save/restore.

// Obj and identifier must not be nil, or will raise UIRestorationObjectRegistrationException.

// Objects do not need to be unregistered when they are deleted, the State Restoration system will notice and stop tracking the object.

//注册自定义对象的使用状态恢复系统

+ (void)registerObjectForStateRestoration:(id<UIStateRestoring>)object restorationIdentifier:(NSString *)restorationIdentifier NS_AVAILABLE_IOS(7_0);

@end



___________________________________

@interface UIApplication(UIApplicationDeprecated)


//距离传感器开启, 可进行监听,有物体靠近设备时发出通知 (iOS3  [UIDevice currentDevice].proximityMonitoringEnabled = YES;)

@property(nonatomic,getter=isProximitySensingEnabled) BOOL proximitySensingEnabled NS_DEPRECATED_IOS(2_0, 3_0) __TVOS_PROHIBITED; // default is NO. see UIDevice for replacement

- (void)setStatusBarHidden:(BOOL)hidden animated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 3_2) __TVOS_PROHIBITED; // use -setStatusBarHidden:withAnimation:


// Explicit setting of the status bar orientation is more limited in iOS 6.0 and later.

//状态栏方向, 转屏

@property(readwrite, nonatomic) UIInterfaceOrientation statusBarOrientation NS_DEPRECATED_IOS(2_0, 9_0, "Explicit setting of the status bar orientation is more limited in iOS 6.0 and later") __TVOS_PROHIBITED;

- (void)setStatusBarOrientation:(UIInterfaceOrientation)interfaceOrientation animated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 9_0, "Explicit setting of the status bar orientation is more limited in iOS 6.0 and later") __TVOS_PROHIBITED;



//状态栏的类型(默认黑色, 白色), UIViewController中也可设置

@property(readwrite, nonatomic) UIStatusBarStyle statusBarStyle NS_DEPRECATED_IOS(2_0, 9_0, "Use -[UIViewController preferredStatusBarStyle]") __TVOS_PROHIBITED;

- (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 9_0, "Use -[UIViewController preferredStatusBarStyle]") __TVOS_PROHIBITED;


//隐藏状态栏

@property(readwrite, nonatomic,getter=isStatusBarHidden) BOOL statusBarHidden NS_DEPRECATED_IOS(2_0, 9_0, "Use -[UIViewController prefersStatusBarHidden]") __TVOS_PROHIBITED;

- (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation NS_DEPRECATED_IOS(3_2, 9_0, "Use -[UIViewController prefersStatusBarHidden]") __TVOS_PROHIBITED;


- (BOOL)setKeepAliveTimeout:(NSTimeInterval)timeout handler:(void(^ __nullable)(void))keepAliveHandler NS_DEPRECATED_IOS(4_0, 9_0, "Please use UIRemoteNotificationTypeVoIP remote notifications for VoIP applications") __TVOS_PROHIBITED;

- (void)clearKeepAliveTimeout NS_DEPRECATED_IOS(4_0, 9_0, "Please use UIRemoteNotificationTypeVoIP remote notifications for VoIP applications") __TVOS_PROHIBITED;


@end





_____________________________________________________________________________

@protocol UIApplicationDelegate<NSObject>    代理协议


@optional


//application 生命周期

//当程序载入后执行

- (void)applicationDidFinishLaunching:(UIApplication *)application;

#if UIKIT_STRING_ENUMS

- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(nullable NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions NS_AVAILABLE_IOS(6_0);

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(nullable NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions NS_AVAILABLE_IOS(3_0);

#else

- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions NS_AVAILABLE_IOS(6_0);

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions NS_AVAILABLE_IOS(3_0);

#endif

//程序进入活动状态,进入前台

- (void)applicationDidBecomeActive:(UIApplication *)application;

//程序将要进入非活动状态,进入后台

- (void)applicationWillResignActive:(UIApplication *)application;



//iOS9之前,URL回调 ("Please use application:openURL:options:"

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url;

//iOS9之前,通过URL进入其他应用返回时会调用此方法,(微信,QQ等, return  [WXApi handleOpenURL:url delegate:[WXApiManager sharedManager]];

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(id)annotation;

//iOS9, 通过URL进入其他应用返回时会调用此方法

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options; 



//内存警告, 可能将要终止程序

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application;      

//将要终止程序

- (void)applicationWillTerminate:(UIApplication *)application;

//系统时间发生改变时执行 // midnight, carrier time update, daylight savings time change

- (void)applicationSignificantTimeChange:(UIApplication *)application;        



//将要转屏

- (void)application:(UIApplication *)application willChangeStatusBarOrientation:(UIInterfaceOrientation)newStatusBarOrientation duration:(NSTimeInterval)duration;

//转屏执行完成

- (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation __TVOS_PROHIBITED;

//改变 StatusBarFrame

- (void)application:(UIApplication *)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame __TVOS_PROHIBITED;   // in screen coordinates

- (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame __TVOS_PROHIBITED;



//注册用户通知

 - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings;

//注册设备Token到服务器

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken NS_AVAILABLE_IOS(3_0);

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error NS_AVAILABLE_IOS(3_0);

//收到推送通知处理

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo;

//收到本地通知处理

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification;

//当您的应用程序被用户从本地通知中选择一个动作启动时调用

- (void)application:(UIApplication *)application handleActionWithIdentifier:(nullable NSString *)identifier forLocalNotification:(UILocalNotification *)notification completionHandler:(void(^)())completionHandler;

//当您的应用程序被用户从远程通知中选择一个动作启动时调用

- (void)application:(UIApplication *)application handleActionWithIdentifier:(nullable NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void(^)())completionHandler;

//"Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"

- (void)application:(UIApplication *)application handleActionWithIdentifier:(nullable NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler;

- (void)application:(UIApplication *)application handleActionWithIdentifier:(nullable NSString *)identifier forLocalNotification:(UILocalNotification *)notification withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void(^)())completionHandler;

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler NS_AVAILABLE_IOS(7_0);




//处理后台获取数据的操作

- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler NS_AVAILABLE_IOS(7_0) __TVOS_PROHIBITED;

//处理后台获取数据操作

- (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)())completionHandler NS_AVAILABLE_IOS(7_0);


// 3D Touch,  桌面快捷入口,

- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void(^)(BOOL succeeded))completionHandler NS_AVAILABLE_IOS(9_0) __TVOS_PROHIBITED;



//apple watch 应用相关  http://www.infoq.com/cn/articles/watch-app-development

- (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(nullable NSDictionary *)userInfo reply:(void(^)(NSDictionary * __nullable replyInfo))reply NS_AVAILABLE_IOS(8_2);



//健康授权   healthKit

- (void)applicationShouldRequestHealthAuthorization:(UIApplication *)application NS_AVAILABLE_IOS(9_0);


//应用进入后台,进行一些清理操作等

- (void)applicationDidEnterBackground:(UIApplication *)application NS_AVAILABLE_IOS(4_0);

//应用进入前台,进行网络检查,刷新,配置等

- (void)applicationWillEnterForeground:(UIApplication *)application NS_AVAILABLE_IOS(4_0);

//受保护的文件当前变为不可用的

- (void)applicationProtectedDataWillBecomeUnavailable:(UIApplication *)application NS_AVAILABLE_IOS(4_0);

//受保护的文件当前变为可用的

- (void)applicationProtectedDataDidBecomeAvailable:(UIApplication *)application    NS_AVAILABLE_IOS(4_0);



@property (nullable, nonatomic, strong) UIWindow *window NS_AVAILABLE_IOS(5_0);

//屏幕方向

- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(nullable UIWindow *)window  NS_AVAILABLE_IOS(6_0) __TVOS_PROHIBITED;

#if UIKIT_STRING_ENUMS

typedef NSString * UIApplicationExtensionPointIdentifier NS_EXTENSIBLE_STRING_ENUM;

#else

typedef NSString * UIApplicationExtensionPointIdentifier;

#endif



//iOS8可用于禁用第三方输入法

- (BOOL)application:(UIApplication *)application shouldAllowExtensionPointIdentifier:(UIApplicationExtensionPointIdentifier)extensionPointIdentifier NS_AVAILABLE_IOS(8_0);



//iOS6应用程序退出时,UI状态的保持和恢复 http://blog.sina.com.cn/s/blog_6d01cce30102v3pv.html

#pragma mark -- State Restoration protocol adopted by UIApplication delegate --

- (nullable UIViewController *) application:(UIApplication *)application viewControllerWithRestorationIdentifierPath:(NSArray *)identifierComponents coder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0);

- (BOOL) application:(UIApplication *)application shouldSaveApplicationState:(NSCoder *)coder NS_AVAILABLE_IOS(6_0);

- (BOOL) application:(UIApplication *)application shouldRestoreApplicationState:(NSCoder *)coder NS_AVAILABLE_IOS(6_0);

- (void) application:(UIApplication *)application willEncodeRestorableStateWithCoder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0);

- (void) application:(UIApplication *)application didDecodeRestorableStateWithCoder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0);



//handoff 开发(真机)

#pragma mark -- User Activity Continuation protocol adopted by UIApplication delegate --

- (BOOL)application:(UIApplication *)application willContinueUserActivityWithType:(NSString *)userActivityType NS_AVAILABLE_IOS(8_0);

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler NS_AVAILABLE_IOS(8_0);

- (void)application:(UIApplication *)application didFailToContinueUserActivityWithType:(NSString *)userActivityType error:(NSError *)error NS_AVAILABLE_IOS(8_0);

- (void)application:(UIApplication *)application didUpdateUserActivity:(NSUserActivity *)userActivity NS_AVAILABLE_IOS(8_0);



//CloudKit 

#pragma mark -- CloudKit Sharing Invitation Handling --

- (void) application:(UIApplication *)application userDidAcceptCloudKitShareWithMetadata:(CKShareMetadata *)cloudKitShareMetadata NS_AVAILABLE_IOS(10_0);


@end































  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值