[英]Error: Invalid argument type 'void' to unary expression
I am a beginner and trying to add a parse push in to my app. 我是一个初学者,正在尝试向我的应用添加解析推送。 However, in line
但是,符合
-(void)application: (UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:
I am getting an error Invalid argument type 'void' to unary expression 我收到一元表达式错误的无效参数类型'void'
What is the error in that? 这有什么错误? Please help.
请帮忙。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[Parse setApplicationId:@"my parse id"
clientKey:@"my parse id"];
**// Register for Push Notitications**
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
UIUserNotificationTypeBadge |
UIUserNotificationTypeSound);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes
categories:nil];
[application registerUserNotificationSettings:settings];
[application registerForRemoteNotifications];
-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// Store the deviceToken in the current installation and save it to Parse.
PFInstallation *currentInstallation = [PFInstallation currentInstallation];
[currentInstallation setDeviceTokenFromData:deviceToken];
[currentInstallation saveInBackground];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
[PFPush handlePush:userInfo];
}
[MGUIAppearance enhanceNavBarAppearance:NAV_BAR_BG];
[MGUIAppearance enhanceBarButtonAppearance:WHITE_TINT_COLOR];
[MGUIAppearance enhanceToolbarAppearance:NAV_BAR_BG];
if (DOES_SUPPORT_IOS7) {
[application setStatusBarStyle:UIStatusBarStyleLightContent];
}
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
UINavigationController* navController = [storyboard instantiateViewControllerWithIdentifier:@"storyboardNavigation"];
sideViewController = [storyboard instantiateViewControllerWithIdentifier:@"storyboardSideView"];
self.slidingViewController = [ECSlidingViewController slidingWithTopViewController:navController];
self.slidingViewController.underLeftViewController = sideViewController;
self.slidingViewController.underRightViewController = nil;
self.slidingViewController.anchorRightPeekAmount = ANCHOR_LEFT_PEEK; //44.0
self.slidingViewController.anchorLeftRevealAmount = ANCHOR_RIGHT_PEEK; //276.0
self.window.rootViewController = self.slidingViewController;
[self.window makeKeyAndVisible];
[[FHSTwitterEngine sharedEngine] permanentlySetConsumerKey:TWITTER_CONSUMER_KEY
andSecret:TWITTER_CONSUMER_SECRET];
[[FHSTwitterEngine sharedEngine]setDelegate:self];
[MGFileManager deleteAllFilesAtDocumentsFolderWithExt:@"png"];
[self setTransitionIndex:[self getTransitionIndex]];
return YES;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[Parse setApplicationId:@"my parse id"
clientKey:@"my parse id"];
**// Register for Push Notitications**
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
UIUserNotificationTypeBadge |
UIUserNotificationTypeSound);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes
categories:nil];
[application registerUserNotificationSettings:settings];
[application registerForRemoteNotifications];
[MGUIAppearance enhanceNavBarAppearance:NAV_BAR_BG];
[MGUIAppearance enhanceBarButtonAppearance:WHITE_TINT_COLOR];
[MGUIAppearance enhanceToolbarAppearance:NAV_BAR_BG];
if (DOES_SUPPORT_IOS7) {
[application setStatusBarStyle:UIStatusBarStyleLightContent];
}
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
UINavigationController* navController = [storyboard instantiateViewControllerWithIdentifier:@"storyboardNavigation"];
sideViewController = [storyboard instantiateViewControllerWithIdentifier:@"storyboardSideView"];
self.slidingViewController = [ECSlidingViewController slidingWithTopViewController:navController];
self.slidingViewController.underLeftViewController = sideViewController;
self.slidingViewController.underRightViewController = nil;
self.slidingViewController.anchorRightPeekAmount = ANCHOR_LEFT_PEEK; //44.0
self.slidingViewController.anchorLeftRevealAmount = ANCHOR_RIGHT_PEEK; //276.0
self.window.rootViewController = self.slidingViewController;
[self.window makeKeyAndVisible];
[[FHSTwitterEngine sharedEngine] permanentlySetConsumerKey:TWITTER_CONSUMER_KEY
andSecret:TWITTER_CONSUMER_SECRET];
[[FHSTwitterEngine sharedEngine]setDelegate:self];
[MGFileManager deleteAllFilesAtDocumentsFolderWithExt:@"png"];
[self setTransitionIndex:[self getTransitionIndex]];
return YES;
}
-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// Store the deviceToken in the current installation and save it to Parse.
PFInstallation *currentInstallation = [PFInstallation currentInstallation];
[currentInstallation setDeviceTokenFromData:deviceToken];
[currentInstallation saveInBackground];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
[PFPush handlePush:userInfo];
}
You don't nest methods? 您不嵌套方法吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.