Tag: 通知

直接从支持iOS8 +的iOS应用redirect到通知设置

我的要求是,如果应用程序的通知被用户closures,用户在那个时候打开应用程序,它会给应用程序打开通知警报,当点击警报视图应用程序的OKbutton将redirect到通知屏幕用户需要点击开关button才能打开通知。 是否有可能在ios8 +? 我想redirect这个屏幕 谢谢

应用程序启动后,我可以获得iOS启动通知吗?

我正在寻找一种方法来检索iOS上的UIApplicationLaunchOptionsLocalNotificationKey不涉及使用应用程序委托,即我不想实现以下: – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UILocalNotification *localNotification = [launchOptions objectForKey: UIApplicationLaunchOptionsLocalNotificationKey]; if (localNotification != nil) { // Process notification } } 我正在尝试创build一个需要启动通知信息的帮助程序库。 有没有这样做? 我可以在应用程序的后期通过另一种方法检索启动选项吗?

立即触发重复本地通知 – 如何推迟?

我的目标是设置一个将在第一时间发生N秒的通知,然后每N秒重复一次。 但是,创build重复通知似乎会立即触发UNUserNotificationCenterDelegate 。 应用程序委托: func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let center = UNUserNotificationCenter.current() center.delegate = self return true } func startRequest() { let content = UNMutableNotificationContent() content.body = bodyText content.categoryIdentifier = categoryIdentifier content.sound = UNNotificationSound.default() let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 60, repeats: true) trigger.nextTriggerDate() let request = UNNotificationRequest(identifier: UUID().uuidString, content: […]

与AVAudioPlayer同步播放MPMoviePlayerController

我正在尝试添加一个电影到游戏的介绍。 这部电影没有声音/音乐。 不过,我确实在背景中有音乐循环。 音乐是有点特定的,因为音乐的介绍和电影一样长,然后节奏快一点。 在iPod 4G这样的设备上,我遇到的问题太快了,这就基本上破坏了电影序列。 这在我的iPhone 4S中不会发生。 我试图寻找某种电影开始播放的通知,然后开始播放音乐。 我一直不成功。 这是我到目前为止: -(void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"SplashVideo" ofType:@"mp4"]]]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerPlaybackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:player]; [[player view] setFrame:CGRectMake(0, 0, 480, 320)]; [player setControlStyle:MPMovieControlStyleNone]; [[self view] addSubview:[player view]]; // play movie [player play]; //musicPlayer is defined in the header [self […]

使用PHP发件人和Swift在后台收到IOS GCM推送通知

我正在使用GCM获取背景通知以在IOS上工作 – 非背景通知已经在工作。 以下是我整合背景通知的步骤: 在UIBackgroundmodes中启用remote-notifications标签 将内容可用密钥添加到我的通知负载。 编写应用程序:didRecieveRemoteNotification:fetchCompletionHandler:在我的委托。 以下是委托函数的代码: func application( application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler handler: (UIBackgroundFetchResult) -> Void) { println("Notification received2: \(userInfo)") GCMService.sharedInstance().appDidReceiveMessage(userInfo); NSNotificationCenter.defaultCenter().postNotificationName(messageKey, object: nil, userInfo: userInfo) handler(UIBackgroundFetchResult.NoData); } 这是服务器上php脚本的代码: <?php $regId = $_GET["regId"]; $message = $_GET["message"]; $data = array( 'price' => $message, 'sound' => 'default', 'body' => 'helloworld', 'title' […]

iPhone如何以编程方式访问通知中心

根据苹果指南: 如果在运行iOS的设备上点击应用程序图标,应用程序将调用相同的方法,但不提供有关通知的信息。 如果应用程序图标在运行的计算机上单击 https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction.html#//apple_ref/doc/uid/TP40008194 据我所知,似乎无法检测到应用程序图标被点击时的通知。 所以我试图以编程方式检索通知中心,但似乎也是不可能的。 以编程方式检索通知中心是不可能的吗? 我想要做的是检测是否收到通知,即使应用程序在后台。

如何跳过重复UNCalendarNotificationTrigger的第一次出现?

说今天是星期一,现在是下午1点。 我想从今天下午2点开始,从我的iOS应用程序安排每周本地通知。 我会这样做: NSDateComponents *components = [[[NSDateComponents alloc]init]autorelease]; components.weekday = 2; components.hour = 14; components.minute = 0; UNCalendarNotificationTrigger *trigger = [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:components repeats:YES]; //then make a UNMutableNotificationContent and UNNotificationRequest and schedule it 但是如果我想在下周一下午2点开始,我怎样才能跳过第一次呢? 以另一种方式提出问题,我该如何安排在某个任意时间开始重复的UNCalendarNotificationTrigger ,而不是重复间隔的第一次出现?

WatchOS中的本地通知3

我正在使用WatchOS 3testing版,并尝试在手表上发起本地通知。 界面只是一个button,在下面的代码中调用“buttonPressed”方法。 该应用程序运行良好,但我从来没有得到通知。 应用程序结构是Xcode 8对于WatchKit应用程序的默认值。 此代码位于WatchKit扩展的InterfaceController.swift文件中 我错过了一些完全明显的东西? @IBAction func buttonPushed() { sendMyNotification() } func sendMyNotification(){ if #available(watchOSApplicationExtension 3.0, *) { let center = UNUserNotificationCenter.current() center.requestAuthorization(options: [.alert, .sound]) { (granted, error) in // Enable or disable features based on authorization. } let content = UNMutableNotificationContent() content.title = NSString.localizedUserNotificationString(forKey: "Hello!", arguments: nil) content.body = NSString.localizedUserNotificationString(forKey: "Hello_message_body", […]

SWIFT:我没有从我的CloudKit应用程序收到通知?

我问这个问题,人们已经回答,但没有任何工作。 这对我来说是非常重要的,我可以得到这个工作。 这是我的一些代码: @IBAction func sendSweet(sender: AnyObject) { //delegate method let newSweet = CKRecord(recordType: "Extra1") newSweet["content"] = textField.text let publicData = CKContainer.defaultContainer().publicCloudDatabase publicData.saveRecord(newSweet, completionHandler: { (record:CKRecord?, error:NSError?) -> Void in if error == nil { dispatch_async(dispatch_get_main_queue(), { () -> Void in self.tableView.beginUpdates() self.sweets.insert(newSweet, atIndex: 0) let indexPath = NSIndexPath(forRow: 0, inSection: 0) self.tableView.insertRowsAtIndexPaths([indexPath], withRowAnimation: .Top) […]

从推送通知中打开应用程序时打开特定的viewcontroller

正如标题所暗示的:当用户通过在推送通知上滑动来启动应用程序时,如何打开特定的视图控制器? 谢谢!