当用户从本地通知中单击“查看”时执行操作

| 当用户从本地通知中单击查看按钮而没有打开发送通知的我的应用时,是否可以执行操作(例如,使用URL方案打开另一个应用)? 一个例子: 我发送了带有alertText“检查您的网站”的本地通知。 用户收到通知,按View,Safari会自动打开而无需打开我的应用程序。 我知道可以立即检查打开我的应用程序并使用URL方案打开safari时的处理方式,但是我认为这样做不太舒服,因为用户每次都看到我的应用程序正在打开。 感谢您的提前答复,如果无法立即理解我的问题(我不是母语人士),则对不起 le     
已邀请:
        要收听这些类型的事件,可以使用以下功能之一:
// On iOS 4.0+ only, listen for background notification

if(&UIApplicationDidEnterBackgroundNotification != nil) 
{
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(function) name:UIApplicationDidEnterBackgroundNotification object:nil];
}

// Register for notification when the app shuts down

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(function) name:UIApplicationWillTerminateNotification object:nil];

// On iOS 4.0+ only, listen for foreground notification

if(&UIApplicationWillEnterForegroundNotification != nil) 
{
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(function) name:UIApplicationWillEnterForegroundNotification object:nil];
}
    
        不,你不能。 按下“查看”​​按钮将触发您的应用。 也许随着新的iOS 5即将面世,某些事情将会改变,下载测试版并看看。     

要回复问题请先登录注册