{"id":20732395,"url":"https://github.com/jpush/jpush-swift-demo","last_synced_at":"2025-08-21T10:19:21.478Z","repository":{"id":69039408,"uuid":"50020406","full_name":"jpush/jpush-swift-demo","owner":"jpush","description":"Offically supported Swift Demo for JPush iOS SDK. ","archived":false,"fork":false,"pushed_at":"2024-05-14T02:02:13.000Z","size":19654,"stargazers_count":56,"open_issues_count":1,"forks_count":14,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-04-23T22:25:26.640Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.jiguang.cn","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jpush.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2016-01-20T09:47:02.000Z","updated_at":"2024-12-17T09:26:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"612da69b-da91-4fd3-ba9a-9da0660e4a0c","html_url":"https://github.com/jpush/jpush-swift-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jpush/jpush-swift-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpush%2Fjpush-swift-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpush%2Fjpush-swift-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpush%2Fjpush-swift-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpush%2Fjpush-swift-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpush","download_url":"https://codeload.github.com/jpush/jpush-swift-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpush%2Fjpush-swift-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271462097,"owners_count":24763860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-17T05:19:11.587Z","updated_at":"2025-08-21T10:19:21.451Z","avatar_url":"https://github.com/jpush.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JPush Swift Demo\n\nOffically supported Swift Demo for JPush iOS SDK. \n\n## JPush SDK 集成步骤 \n\n### 1. 集成SDK到项目\n\n#### 1.1 手动集成\n##### 添加工程文件到\n\n![image](https://github.com/jpush/jpush-swift-demo/blob/master/ReadMeRecource/添加jpushSDK到工程中%20.gif)\n\n#### 在Link Binary with Libraries 添加下图的依赖库\n\n![image](https://github.com/jpush/jpush-swift-demo/blob/master/ReadMeRecource/添加依赖库文件.png)\n\n\n#### 1.2 cocoapods 集成\n\n##### 在PodFile文件中添加\n\n```\n  pod 'JPush'\n  pod 'JCore'\n```\n\n运行pod install\n\n\n#### 2. 在工程中新建一个 Objective-C Bridging Header 文件\n\n![image](https://github.com/jpush/jpush-swift-demo/blob/master/ReadMeRecource/生成ObjCBridge文件.gif)\n\n#### 3. 在刚生成的Objective-C Bridging Header文件中导入 jpush 头文件\n\n![image](https://github.com/jpush/jpush-swift-demo/blob/master/ReadMeRecource/在ObjctBridgingHeader添加sdk头文件.gif)\n\n#### 4. 在Appdelegate.swift 文件的 didFinishLaunching 方法中添加如下代码\n\n\n```\n  func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -\u003e Bool {\n    \n    if((UIDevice.currentDevice().systemVersion as NSString).floatValue \u003e= 8.0) {\n      // 可以自定义 categories\n      JPUSHService.registerForRemoteNotificationTypes(UIUserNotificationType.Badge.rawValue | UIUserNotificationType.Badge.rawValue | UIUserNotificationType.Alert.rawValue , categories: nil)\n    } else {\n      JPUSHService.registerForRemoteNotificationTypes(UIUserNotificationType.Badge.rawValue | UIUserNotificationType.Badge.rawValue | UIUserNotificationType.Alert.rawValue , categories: nil)\n    }\n    JPUSHService.setupWithOption(launchOptions, appKey: appKey, channel: channel, apsForProduction: isProduction)\n    \n    return true\n  }\n```\n\n#### 5. 在Appdelegate.swift 文件的 didRegisterForRemoteNotificationsWithDeviceToken 方法中添加如下代码\n\n\n```\n  func application(application: UIApplication,\n    didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {\n      print(\"get the deviceToken  \\(deviceToken)\")\n      NSNotificationCenter.defaultCenter().postNotificationName(\"DidRegisterRemoteNotification\", object: deviceToken)\n      JPUSHService.registerDeviceToken(deviceToken)\n      \n  }\n```\n\n到此 已经完成集成 JPush sdk 的基本功能，若需要更多功能请参考Demo工程\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpush%2Fjpush-swift-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpush%2Fjpush-swift-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpush%2Fjpush-swift-demo/lists"}