小编sta*_*eet的帖子

为什么appdelegate中的函数没有被调用?

我试图将当前用户添加到安装类,但由于某种原因,该函数未被调用.我究竟做错了什么?我该如何解决?下面是finishlaunchingwithoptions和didregisterfornotifications.

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



    Parse.enableLocalDatastore()

    // Initialize Parse.
    Parse.setApplicationId("***********************",
        clientKey: "****************************")




    let settings = UIUserNotificationSettings(forTypes: [.Alert, .Sound, .Badge], categories: nil)
    UIApplication.sharedApplication().registerUserNotificationSettings(settings)
    UIApplication.sharedApplication().registerForRemoteNotifications()

    if let launchOptions = launchOptions as? [String : AnyObject] {
        if let notificationDictionary = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey] as? [NSObject : AnyObject] {
            self.application(application, didReceiveRemoteNotification: notificationDictionary)
        }
    }

    return true
}

func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
    // Store the deviceToken in the current Installation …
Run Code Online (Sandbox Code Playgroud)

ios parse-platform swift

2
推荐指数
1
解决办法
471
查看次数

反正有保存推送通知吗?

当用户a向用户b发送推送通知时,用户b将收到通知,但是一旦他们点击该通知,该通知的有效负载就会消失.相反,当用户b打开通知时,通知中的有效负载将保存为解析,因此他可以查看发送给他的所有通知.这就像是通知历史.以下是我发送通知的代码.我需要有关如何在这些通知中保存有效负载的帮助,以便用户可以查看通知历史记录.

func pushNotifications(){


    let userQuery: PFQuery = PFUser.query()!
    userQuery.whereKey("objectId", containedIn: Array(setOfSelectedFriends)) 

    let pushQuery: PFQuery = PFInstallation.query()!
    pushQuery.whereKey("user", matchesQuery: userQuery)

    let push = PFPush()
    push.setQuery(pushQuery)
    push.setMessage("\(username!) wants you to meet them at \(location!)")

    push.sendPushInBackgroundWithBlock {
        success, error in

        if success {
            print("The push succeeded.")
        } else {
            print("The push failed.")
        }
    }

}
Run Code Online (Sandbox Code Playgroud)

push-notification ios parse-platform swift

2
推荐指数
1
解决办法
687
查看次数

如何"注销"解析命令行?

我正在使用云代码,我有两个Parse帐户.我已授权第一个Parse帐户,但我想将云代码添加到新的Parse帐户,但每当我这样做时Parse add,它会自动将我带到我已授权的解析帐户的应用程序列表中,如何启动应用程序从另一个帐户?

terminal parse-platform

2
推荐指数
1
解决办法
296
查看次数

如何更改表情符号的颜色?

我有一个表情符号,我希望它是白色的,但是当我运行该程序时,它显示为红色。如何将其更改为白色?

rating.text = "\(?????)"
rating.textColor = UIColorRGB("ffffff")
Run Code Online (Sandbox Code Playgroud)

ios emoji swift

2
推荐指数
1
解决办法
5907
查看次数

标签 统计

ios ×3

parse-platform ×3

swift ×3

emoji ×1

push-notification ×1

terminal ×1