回答
更新:SWIFT 3.0:
如何與火力地堡您的iOS項目整合。
,以便與火力地堡的項目中集成的推送通知,你需要做到以下幾點:
使用的CocoaPods與火力地堡集成項目。打開終端並編寫cd然後將包含您的項目的文件夾拖到終端,以避免編寫整個路徑。
一旦你在終端裏面的文件夾,寫上:
$莢初始化
和新文件會爲您創建一個名爲Podfile
內的項目打開Podfile file in您的文本編輯器並在結束關鍵字前添加pod'Firebase'。
保存該文件並返回到終端,並確保您仍在項目路徑中。
然後在終端中編寫pod install,這應該開始下載Firebase並將其與您的項目集成。
6.一旦完成下載,你應該看到在你的項目文件夾中的新文件與.xcworkspace擴展。這是您現在應該打開的文件。
- 轉到下面的鏈接並生成證書,以便將其上傳到控制檯中的Firebase項目。
https://www.mobiloud.com/help/knowledge-base/how-to-export-push-notification-certificate-p12/
打開項目,然後導航到AppDelegate中並執行以下操作;
//導入您的應用程序的頂部框架
import Firebase
現在內部應用:didFinishLaunchingWithOptions:方法中添加
//使用火力地堡庫來配置的API
FIRApp.configure()
內部registerForRemoteNotifications方法添加以下:
let settings: UIUserNotificationSettings = UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil) application.registerUserNotificationSettings(settings) application.registerForRemoteNotifications()
您應該添加以下方法AppDelegate中,以便您在應用程序運行時接收消息;
func application(application:UIApplication,didReceiveRemoteNotification userInfo: [NSObject : AnyObject],fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) { print("Message ID: \(userInfo["gcm.message_id"]!)") }
按照下面的鏈接,以測試發送推
。
更新時間:SWIFT 3.0:
UNUserNotificationCenter.current().requestAuthorization(options: [.alert,.badge,.sound]) { (granted:Bool, error:Error?) in
if granted {
}else{
}
}
UNUserNotificationCenter.current().delegate = self
和委託:
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
}
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping() -> Void) {
}
https://firebase.google.com/docs/notifications/ios/console-device
有任何SDK,這就是所謂文檔提供的東西。這裏是Firebase documentations的鏈接。按照這一步一步一步解釋。
此外,您還可以從GitHub的repository消息中找到FCM(雲消息傳遞)的示例項目。
在這段旅程中,如果你遇到任何困難,那麼在這裏發佈你真正的問題(問題),有人可以引導你通過。
- 1. Firebase推送通知
- 2. 應用引擎iOS推送通知項目不發送通知
- 3. 通過兩個Firebase項目發送推送通知
- 4. firebase iOS沒有收到推送通知
- 5. iOS中的Firebase推送通知
- 6. Swift IOS 10 Firebase推送通知
- 7. Firebase推送通知操作
- 8. Firebase觀衆 - 推送通知
- 9. 推送通知IOS
- 10. 推送通知IOS
- 11. iOS推送通知 -
- 12. iOs推送通知
- 13. 通過Firebase發送推送通知
- 14. 在展會項目中推送通知
- 15. Apple推送通知或Firebase推送通知?
- 16. ios發送與firebase通知
- 17. 使用Firebase實施科爾多瓦項目的推送通知
- 18. 分組ios推送通知目標
- 19. ios10,Swift 3和Firebase推送通知(FCM)
- 20. 發送了兩次Firebase推送通知
- 21. 在推送通知中發送URL Firebase
- 22. 使用volley發送firebase推送通知
- 23. 從JavaScript/jQuery發送Firebase推送通知
- 24. Swift Firebase發送推送通知
- 25. 如何發送推送通知Firebase
- 26. 解析爲Firebase增強推送通知
- 27. 從Firebase發送推送通知到Android以及iOS
- 28. Firebase從設備發送推送通知(IOS)
- 29. 使用OneSignal/Firebase從iOS設備發送推送通知
- 30. Firebase推送通知在後臺振動
他們有他們的樣品。檢查文檔站點。這不是要求參考項目/庫的地方。 – Shubhank
有關構建iOS應用程序的代碼實驗:https://codelabs.developers.google.com/codelabs/firebase-ios-swift/ –