预期返回“布尔”parse.com 推送通知的函数中缺少返回
Posted
技术标签:
【中文标题】预期返回“布尔”parse.com 推送通知的函数中缺少返回【英文标题】:Missing return in a function expected to return 'Bool' parse.com push notification 【发布时间】:2015-01-19 13:13:56 【问题描述】:我正在尝试将推送通知与 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'
【问题讨论】:
【参考方案1】:该函数需要一个布尔值作为返回值。
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
// Your code.
return true
【讨论】:
以上是关于预期返回“布尔”parse.com 推送通知的函数中缺少返回的主要内容,如果未能解决你的问题,请参考以下文章