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(@"
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745256311a4618977.html
评论列表(0条)