{"id":19317728,"url":"https://github.com/queeniecplusplus/ios_back_15","last_synced_at":"2026-05-13T21:33:34.822Z","repository":{"id":104588302,"uuid":"333999643","full_name":"QueenieCplusplus/iOS_Back_15","owner":"QueenieCplusplus","description":"PN, 本地推播","archived":false,"fork":false,"pushed_at":"2021-01-29T13:08:31.000Z","size":2118,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-24T04:44:46.201Z","etag":null,"topics":["push-notifications","pushnotifications"],"latest_commit_sha":null,"homepage":"https://github.com/QueenieCplusplus/QuickGoThru/blob/master/README.md#apple-ios-swift-溫故愛鳳---計畫復甦","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QueenieCplusplus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-29T01:07:31.000Z","updated_at":"2021-01-29T13:08:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"bfec5219-44b0-4d24-9a15-026c045fd6b2","html_url":"https://github.com/QueenieCplusplus/iOS_Back_15","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/QueenieCplusplus/iOS_Back_15","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QueenieCplusplus%2FiOS_Back_15","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QueenieCplusplus%2FiOS_Back_15/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QueenieCplusplus%2FiOS_Back_15/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QueenieCplusplus%2FiOS_Back_15/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QueenieCplusplus","download_url":"https://codeload.github.com/QueenieCplusplus/iOS_Back_15/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QueenieCplusplus%2FiOS_Back_15/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33000997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"ssl_error","status_checked_at":"2026-05-13T13:14:51.610Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["push-notifications","pushnotifications"],"created_at":"2024-11-10T01:16:05.346Z","updated_at":"2026-05-13T21:33:34.785Z","avatar_url":"https://github.com/QueenieCplusplus.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iOS_Back_15\nPN, 本地推播\n\n\n![](https://raw.githubusercontent.com/QueenieCplusplus/iOS_Back_15/main/output%202.png)\n\n\n1. code.\n\n\n              class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {\n\n\n\n                func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n                    // Override point for customization after application launch.\n\n                    // 推播中心的迸發執行緒\n                    // ask user the autherization\n                    let nc = UNUserNotificationCenter.current()\n                    nc.delegate = self\n\n                    nc.requestAuthorization(options: [.alert, .sound, .badge]){\n\n                        (granted, error) in\n                        if granted == false {\n                            print(\" 權限不足，Auth is limited.\")\n                        }\n\n                    }\n\n                    notifyUser()\n                    return true\n                }\n\n                // design the notify body\n\n                func notifyUser(){\n\n                    let txt = UNMutableNotificationContent()\n                    txt.title = \"這是來自 Kate 的推播放喔！\"\n                    txt.body = \"普普貓問：今天有定時定樣餵食我嗎？\"\n                    txt.badge = 3\n                    txt.sound = UNNotificationSound.default\n\n                    let tg = UNTimeIntervalNotificationTrigger(timeInterval: 61, repeats: true)\n                    let req = UNNotificationRequest(identifier: \"mytargetid\", content: txt, trigger: tg)\n\n                    // 推播中心的迸發執行緒\n                    let nc = UNUserNotificationCenter.current()\n                    nc.delegate = self\n                    nc.add(req)\n\n                }\n\n                // 上方為銀幕鎖上或是 Home 時的推播狀態設定。\n                // 前景 app 出現本地推播通知要額外實作 userNotificationCenter。\n\n\n2. ask for auth.\n\n  ![](https://raw.githubusercontent.com/QueenieCplusplus/iOS_Back_15/main/output%201.png)\n\n3. time interval and repeat.\n\n    版主私心：普普貓每 61 秒提醒一次餵食通知。\n\n    ![](https://raw.githubusercontent.com/QueenieCplusplus/iOS_Back_15/main/timeInterval.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqueeniecplusplus%2Fios_back_15","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqueeniecplusplus%2Fios_back_15","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqueeniecplusplus%2Fios_back_15/lists"}