小编App*_*per的帖子

我想一直运行服务甚至应用程序在Swift IOS中关闭,终止或终止

这是我想要一直运行的示例代码服务

internal func backService()
    {
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), { () -> Void in
            let anObject = try! Realm().objects(remindertbl).filter("status = 0")
            print("here")
            for loop in anObject
            {
                let dateFormatter = NSDateFormatter()
                dateFormatter.dateFormat = "dd/MM/yyyy hh:mm a"
                let  timestamp = dateFormatter.stringFromDate(NSDate())
                let timeStampint = dateFormatter.dateFromString(timestamp)!.timeIntervalSince1970
                if(loop.reminderdays == Int64(timeStampint))
                {
                    if(loop.status == 0){                            

                    let notification = UILocalNotification()
                    notification.fireDate = NSDate(timeIntervalSince1970: 0)
                    notification.alertBody = "\(loop.title)"
                    notification.alertAction = "swipe to opem VLB Cloud!"
                    notification.soundName = UILocalNotificationDefaultSoundName
                    notification.userInfo = ["CustomField1": "w00t"]
                    UIApplication.sharedApplication().scheduleLocalNotification(notification)

                    let updateObject = try! Realm().objects(remindertbl).filter("status …
Run Code Online (Sandbox Code Playgroud)

background ios swift

0
推荐指数
1
解决办法
1743
查看次数

标签 统计

background ×1

ios ×1

swift ×1