错误:参数类型无效' void'一元的表达

时间:2015-04-13 20:51:35

标签: c++ ios objective-c

我是初学者并尝试在我的应用中添加解析推送。但是,在行

-(void)application: (UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:

我收到错误一元表达式的无效参数类型'void'

那是什么错误?请帮忙。

- (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;
}

1 个答案:

答案 0 :(得分:0)

- (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];
}

你没有嵌套方法?