didFinishLaunchingWithOptions
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Description: Executed when the application starts, the application starts the entry. Executed only once when the application starts. The application parameter is used to obtain the state, variables, etc. of the application. It is worth noting that the dictionary parameter: (NSDictionary *) launchOptions, which stores the reason for the program startup. If the user launches directly, there is no data in launchOptions; if it is launched by other applications through openURL:, the object corresponding to UIApplicationLaunchOptionsURLKey is the launch URL (NSURL), and UIApplicationLaunchOptionsSourceApplicationKey corresponds to the bundle ID (NSString) of the launched source application; if notified locally If it is started, UIApplicationLaunchOptionsLocalNotificationKey corresponds to the local notification object (UILocalNotification) for launching the application; if it is started by remote notification, UIApplicationLaunchOptionsRemoteNotificationKey corresponds to the remote notification information userInfo (NSDictionary) for launching the application; other keys are UIApplicationLaunchOptionsAnnotationKey, UIApplicationLaunchOptionsLocationKey, UIApplicationLaunchOptionsNewsstandDownloadsKey. If you want to make some distinctions at startup, you need to do it in the following code. For example: an application can be invoked by some other application (as a sub-application of the application), to achieve single sign-on, it is necessary to make reasonable verification in the place of startup code and skip the login.- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ NSURL *url = [launchOptionsobjectForKey:UIApplicationLaunchOptionsURLKey];
if(url) {
}
NSString *bundleId = [launchOptionsobjectForKey:UIApplicationLaunchOptionsSourceApplicationKey];
if(bundleId) {
} UILocalNotification * localNotify = [launchOptionsobjectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if(localNotify) { }
NSDictionary * userInfo = [launchOptionsobjectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; if(userInfo) {
}}
/**
* app ,app kill, , app app,return NO application: openURL:sourceApplication:annotation:( app )
*/
if (launchOptions) {
NSString *appIDF = [launchOptionsobjectForKey:UIApplicationLaunchOptionsSourceApplicationKey];
if (appIDF && [appIDFisEqualToString:@"com.alipay.iphoneclient"]) {
returnNO;
}
}
#pragma mark-- app url
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
NSString *urlStr = [urlabsoluteString];
// app app
if(sourceApplication && [sourceApplicationisEqualToString:@"com.alipay.iphoneclient"]){
[[AlipaySDKdefaultService] processOrderWithPaymentResult:urlstandbyCallback:^(NSDictionary *resultDic) {
NSDictionary *dict = @{ALIPayDidCompleteURLKey:urlStr};
[[NSNotificationCenterdefaultCenter ] postNotificationName:ALIPayFromZFBDidCompleteNotificationobject:resultDic userInfo:dict];
}];
}
returnYES;
}
//
[[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(processAliPayResult:)name:ALIPayFromZFBDidCompleteNotificationobject:nil];
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.