最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

parse platform - Sending Push to tvOS - Stack Overflow

programmeradmin0浏览0评论

I have a tvOS Obj-C app that I'm having issues with sending a silent notification. I use Parse on back4app and am using CloudCode so when I save a class, it sends a silent notification the Apple TV and makes some changes there.

In my AppDelegate.m I have:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration> configuration) {
        configuration.applicationId = @"APPID";
        configuration.clientKey = @"CLIENTKEY";
        configuration.server = @";;
    }]];
    self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
      
      // Load the Main storyboard
      UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
      
      // Instantiate the initial view controller from the storyboard
      UITabBarController *tabBarController = [mainStoryboard instantiateInitialViewController];
      
      // Set the tab bar controller as the root view controller
      self.window.rootViewController = tabBarController;
      
      // Make the window key and visible
      [self.window makeKeyAndVisible];
    [application registerForRemoteNotifications];

         
    return YES;
}


- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
    if ([userInfo[@"action"] isEqualToString:@"update_songs_list"]) {
        NSLog(@"Received push notification: Updating song list.");

        // Post a notification so the relevant view controller can handle it
        [[NSNotificationCenter defaultCenter] postNotificationName:@"UpdateSongsListNotification" object:nil];
    }
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
    if ([userInfo[@"action"] isEqualToString:@"update_songs_list"]) {
        NSLog(@"
发布评论

评论列表(0)

  1. 暂无评论