ios - 预期返回 'Bool' parse.com 推送通知的函数中缺少返回

标签 ios swift parse-platform push-notification push

我正在尝试通过 swift&parse.com 使用推送通知。我正在接受这个错误。 我该如何解决这个问题。

  func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.
    self.pushNotificationController = PushNotificationController()

    // Register for Push Notitications, if running iOS 8
    if application.respondsToSelector("registerUserNotificationSettings:") {

        let types:UIUserNotificationType = (.Alert | .Badge | .Sound)
        let settings:UIUserNotificationSettings = UIUserNotificationSettings(forTypes: types, categories: nil)

        application.registerUserNotificationSettings(settings)
        application.registerForRemoteNotifications()

    } else {
        // Register for Push Notifications before iOS 8
        application.registerForRemoteNotificationTypes(.Alert | .Badge | .Sound)
    }


 }//Missing return in a function expected to return 'Bool'

最佳答案

该函数需要一个 bool 值作为返回值。

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool 
{
   // Your code.
   return true
}

关于ios - 预期返回 'Bool' parse.com 推送通知的函数中缺少返回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28025458/

相关文章:

ios - 如何使用 Swift 4 从 CMSampleBuffer 创建数据

objective-c - 如何确定UIPickerView旋转方向?

ios - react-native:推送通知+解析

ios - 使用 Stripe 和 Parse 存储信用卡。没有方法每个错误

ios - 如何在 React Native 中添加 float 工具提示?

ios - 我可以使用 AppCode 而其他人在我的团队中使用 Xcode 吗?

ios - Swift -Ounchecked 和断言

ios - 从 UIImage 输出固定大小的 JPEG

swift - 如何快速通过经过身份验证的认知用户(用户池)访问 DynamoDB

java - 如何在解析时存储日期和时间