{"id":1114,"date":"2020-10-08T17:19:04","date_gmt":"2020-10-08T09:19:04","guid":{"rendered":"http:\/\/123.57.164.21\/?p=1114"},"modified":"2020-10-08T17:19:04","modified_gmt":"2020-10-08T09:19:04","slug":"ios-%e5%8f%91%e9%80%81-%e5%b8%a6%e5%9b%be%e7%89%87%e7%9a%84-%e6%9c%ac%e5%9c%b0%e6%b6%88%e6%81%af","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=1114","title":{"rendered":"IOS \u53d1\u9001 \u5e26\u56fe\u7247\u7684 \u672c\u5730\u6d88\u606f"},"content":{"rendered":"\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30ed\u30fc\u30ab\u30eb\u901a\u77e5\n            let content = UNMutableNotificationContent()\n            content.title = \"\u901a\u77e5\"\n            content.body = \"This is a message\"\n            content.sound = .default\n            \n            \/\/ \u52a0\u8f7d\u672c\u5730\u7684\u4e00\u5f20\u56fe\u7247\u4f5c\u4e3a\u9644\u4ef6\n            if let url = Bundle.main.url(forResource: \"icon-76\", withExtension: \"png\") {\n                if let attch = try? UNNotificationAttachment(identifier: \"identifierAttachment\", url: url, options: nil) {\n                    content.attachments = [attch]\n                }\n\n            }\n            \/\/ \u30c8\u30ea\u30ac\u30fc\n            let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 0.1, repeats: false)\n            let requestIdentifier = \"com.localNotification.\" + String(Date().timeIntervalSince1970)\n\n            \/\/ \u901a\u77e5\u30ea\u30af\u30a8\u30b9\u30c8\n            let request = UNNotificationRequest(identifier: requestIdentifier,\n                content: content, trigger: trigger)\n\n            \/\/ \u901a\u77e5\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u9001\u4fe1\n            UNUserNotificationCenter.current().add(request) { error in\n                if error == nil {\n                    print(\"Time Interval Notification scheduled: \\(requestIdentifier)\")\n                } else {\n                    print(\"Time error: \\(String(describing: error))\")\n                }\n            }<\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/1114"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1114"}],"version-history":[{"count":1,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/1114\/revisions"}],"predecessor-version":[{"id":1115,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/1114\/revisions\/1115"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}