gpt4 book ai didi

iphone - 收到推送通知时如何打开另一个屏幕而不是主屏幕

转载 作者:太空狗 更新时间:2023-10-30 03:33:37 25 4
gpt4 key购买 nike

我需要知道如何在收到推送通知时打开另一个 View Controller 而不是主视图 Controller 请帮助我提前谢谢这是我的代码“

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
sleep(2);
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)];

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
consumerId = [[ud objectForKey:@"consumerId"] intValue];

couponSql = [[CouponsSqlClass alloc] init];

if (consumerId == 0) {
self.viewController = [[LandingPageViewController alloc] initWithNibName:@"LandingPageViewController" bundle:nil];
self.window.rootViewController = self.viewController;
}
else {
application.applicationIconBadgeNumber = 0;

EditProfileViewController* mainViewController = [[EditProfileViewController alloc] initWithNibName:@"EditProfileViewController" bundle:nil];
_mainViewNavController = [[UINavigationController alloc] initWithRootViewController:mainViewController];
KluebookMenuViewController* leftSideMenuViewController = [[KluebookMenuViewController alloc] initWithNibName:@"KluebookMenuViewController" bundle:nil];
self.deskController = [[IIViewDeckController alloc] initWithCenterViewController:self.mainViewNavController leftViewController:leftSideMenuViewController];
self.deskController.leftLedge = 60;
self.window.rootViewController = self.deskController;
}
[self.window makeKeyAndVisible];

return YES;
}

最佳答案

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

if (launchOptions != nil) {
// Launched from push notification
NSDictionary *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
//Redirect it to your page here
}
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
if ( application.applicationState == UIApplicationStateInactive || application.applicationState == UIApplicationStateBackground )
{
//opened from a push notification when the app was on background
//Redirect it to your page here
}
}

关于iphone - 收到推送通知时如何打开另一个屏幕而不是主屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18056535/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com