我无法在离子3应用程序中订阅ios中的主题 . 我可以获得注册ID并成功发送推送到ios设备,但无法订阅主题 . 在android中,主题没有问题 . 当我检查xcode中的日志时,它显示“FCM令牌为空,无法订阅主题” . 但它也说“成功订阅主题iosuser” . 我将ios平台中的firebase消息更新到2.0.0.8,但仍然遇到了问题 .
这是登录xcode;
>2018-05-18 15:25:56.659236+0300 myapp[1823:673535] DiskCookieStorage changing policy from 2 to 0, cookie file:
> file:///private/var/mobile/Containers/Data/Application/250DBEDD-FDCC-4396-B7AC-19E24A136CAF/Library/Cookies/Cookies.binarycookies
>2018-05-18 15:25:56.720246+0300 myapp[1823:673535] Apache Cordova native platform version 4.5.3 is starting.
>2018-05-18 15:25:56.721616+0300 myapp[1823:673535] Multi-tasking -> Device: YES, App: YES
>2018-05-18 15:25:56.735189+0300 myapp[1823:673535] CDVWKWebViewEngine: trying to inject XHR polyfill
>2018-05-18 15:25:56.802868+0300 myapp[1823:673535] [MC] Lazy loading NSBundle MobileCoreServices.framework
>2018-05-18 15:25:56.803906+0300 myapp[1823:673535] [MC] Loaded MobileCoreServices.framework
>2018-05-18 15:25:56.806947+0300 myapp[1823:673535] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
>2018-05-18 15:25:58.410923+0300 myapp[1823:673535] CDVWKWebViewEngine will reload WKWebView if required on resume
>2018-05-18 15:25:58.411055+0300 myapp[1823:673535] Using Ionic WKWebView
>2018-05-18 15:25:58.411876+0300 myapp[1823:673535] [CDVTimer][console] 0.107050ms
>2018-05-18 15:25:58.412168+0300 myapp[1823:673535] [CDVTimer][handleopenurl] 0.111938ms
>2018-05-18 15:25:58.415828+0300 myapp[1823:673535] [CDVTimer][intentandnavigationfilter] 3.606081ms
>2018-05-18 15:25:58.416006+0300 myapp[1823:673535] [CDVTimer][gesturehandler] 0.100970ms
>2018-05-18 15:25:58.416114+0300 myapp[1823:673535] CDVIonicKeyboard: resize mode 1
>2018-05-18 15:25:58.417194+0300 myapp[1823:673535] [CDVTimer][keyboard] 1.065016ms
>2018-05-18 15:25:58.432220+0300 myapp[1823:673535] [CDVTimer][splashscreen] 14.935017ms
>2018-05-18 15:25:58.440578+0300 myapp[1823:673535] [CDVTimer][statusbar] 8.210063ms
>2018-05-18 15:25:58.440669+0300 myapp[1823:673535] [CDVTimer][TotalPluginStartup] 29.013038ms
>2018-05-18 15:25:58.449576+0300 myapp[1823:673535] createNotificationChecker
>2018-05-18 15:25:58.449641+0300 myapp[1823:673535] not coldstart
>2018-05-18 15:25:58.518857+0300 myapp[1823:673535] refreshPreferences: HangTracerEnabled: 0
>2018-05-18 15:25:58.518924+0300 myapp[1823:673535] refreshPreferences: HangTracerDuration: 500
>2018-05-18 15:25:58.518953+0300 myapp[1823:673535] refreshPreferences: ActivationLoggingEnabled: 0
> ActivationLoggingTaskedOffByDA:0
> 2018-05-18 15:25:58.519382+0300 myapp[1823:673535] active
> 2018-05-18 15:25:58.519615+0300 myapp[1823:673535] PushPlugin skip clear badge
> 2018-05-18 15:26:00.983732+0300 myapp[1823:673535] Ionic Native: deviceready event fired after 1721 ms
> 2018-05-18 15:26:01.006413+0300 myapp[1823:673535] subscribe from topic: iosuser
> 2018-05-18 15:26:01.089892+0300 myapp[1823:673535] Successfully subscribe to topic iosuser
>2018-05-18 15:26:01.090083+0300 myapp[1823:673535] THREAD WARNING: ['PushNotification'] took '83.765869' ms. Plugin should use a background thread.
>2018-05-18 15:26:01.091120+0300 myapp[1823:673535] Push Plugin VoIP missing or false
>2018-05-18 15:26:01.091991+0300 myapp[1823:673582] Push Plugin register called
>2018-05-18 15:26:01.092051+0300 myapp[1823:673582] PushPlugin.register: setting badge to true
>=================================================================
>Main Thread Checker: UI API called on a background thread: -[UIApplication setApplicationIconBadgeNumber:]
>PID: 1823, TID: 673582, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 21
>Backtrace:
>4 myapp 0x00000001006ce554 __19-[PushPlugin init:]_block_invoke.280 + 1188
>5 libdispatch.dylib 0x0000000100ded49c _dispatch_call_block_and_release + 24
>6 libdispatch.dylib 0x0000000100ded45c _dispatch_client_callout + 16
>7 libdispatch.dylib 0x0000000100df956c _dispatch_queue_override_invoke + 980
>8 libdispatch.dylib 0x0000000100dfeb54 _dispatch_root_queue_drain + 616
>9 libdispatch.dylib 0x0000000100dfe880 _dispatch_worker_thread3 + 136
>10 libsystem_pthread.dylib 0x000000018710f120 _pthread_wqthread + 1268
>11 libsystem_pthread.dylib 0x000000018710ec20 start_wqthread + 4
>2018-05-18 15:26:01.096217+0300 myapp[1823:673582] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication setApplicationIconBadgeNumber:]
PID: 1823, TID: 673582, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 21
> Backtrace:
> 4 myapp 0x00000001006ce554 __19-[PushPlugin init:]_block_invoke.280 + 1188
> 5 libdispatch.dylib 0x0000000100ded49c _dispatch_call_block_and_release + 24
> 6 libdispatch.dylib 0x0000000100ded45c _dispatch_client_callout + 16
> 7 libdispatch.dylib 0x0000000100df956c _dispatch_queue_override_invoke + 980
> 8 libdispatch.dylib 0x0000000100dfeb54 _dispatch_root_queue_drain + 616
> 9 libdispatch.dylib 0x0000000100dfe880 _dispatch_worker_thread3 + 136
> 10 libsystem_pthread.dylib 0x000000018710f120 _pthread_wqthread + 1268
> 11 libsystem_pthread.dylib 0x000000018710ec20 start_wqthread + 4
> 2018-05-18 15:26:01.171575+0300 myapp[1823:673582] PushPlugin.register: clear badge is set to 1
> 2018-05-18 15:26:01.171631+0300 myapp[1823:673582] PushPlugin.register: better button setup
> 2018-05-18 15:26:01.172954+0300 myapp[1823:673582] FCM Sender ID *************
> 2018-05-18 15:26:01.173019+0300 myapp[1823:673582] Using FCM Notification
> 2018-05-18 15:26:01.318129+0300 myapp[1823:673535] FCM token is null
> 2018-05-18 15:26:01.341181+0300 myapp[1823:673581] 4.13.0 - [Firebase/Messaging][I-FCM002010] Cannot subscribe to topic: iosuser
> with token: (null)
> 2018-05-18 15:26:01.341248+0300 myapp[1823:673581] 4.13.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been
> configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in
> Swift) to your application initialization.
> 2018-05-18 15:26:01.341347+0300 myapp[1823:673581] 4.13.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications
> proxy enabled, will swizzle remote notification receiver handlers. If
> you'd prefer to manually integrate Firebase Messaging, add
> "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to
> NO. Follow the instructions at:
> https://firebase. google.com/docs/cloud-messaging/ios /client #method_swizzling_in_firebase_messaging
> to ensure proper integration.
> 2018-05-18 15:26:01.343849+0300 myapp[1823:673611] 4.13.0 - [Firebase/Analytics][I-ACS023007] Firebase Analytics v.40200000
> started
> 2018-05-18 15:26:01.344184+0300 myapp[1823:673611] 4.13.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the
> following application argument: -FIRAnalyticsDebugEnabled
> 2018-05-18 15:26:01.457068+0300 myapp[1823:673535] Push Plugin register success: <942ac913 e1cfcb04 281a93c2 fd3e0075 15ba8bbf
> c19b6a31 e31e3908 972283c1>
> 2018-05-18 15:26:01.548384+0300 myapp[1823:673592] [BoringSSL] Function boringssl_context_get_peer_sct_list: line 1757 received sct
> extension length is less than sct data length
> 2018-05-18 15:26:01.587282+0300 myapp[1823:673581] [BoringSSL] Function boringssl_context_get_peer_sct_list: line 1757 received sct
> extension length is less than sct data length
> 2018-05-18 15:26:01.802237+0300 myapp[1823:673592] TIC Read Status [1:0x0]: 1:57
> 2018-05-18 15:26:01.802885+0300 myapp[1823:673592] TIC Read Status [1:0x0]: 1:57
> 2018-05-18 15:26:02.009051+0300 myapp[1823:673535] CDVWKWebViewEngine: handleStopScroll
> 2018-05-18 15:26:03.711731+0300 myapp[1823:673535] The FCM registration token needs to be changed.
> 2018-05-18 15:26:03.723836+0300 myapp[1823:673535] FCM Registration Token:
> cDfIEgI_8EE:APA91bE9-4H1Z2baLKHWv-T7fcbWKUaeJb1TY89csKX4TyfJsuMx2k6eXYMDMhWaBvtCRomUyJf6QGj9KqqJ4iGdHphZlC0X2oS70LtvMcael7k2rM5-v1sGTg2CS-VtP5AE2PD5mv3I
> 2018-05-18 15:26:03.861108+0300 myapp[1823:673535] cihaz notifikasyona kaydedildi:
> 2018-05-18 15:26:09.640707+0300 myapp[1823:673535] active
> 2018-05-18 15:26:09.640914+0300 myapp[1823:673535] PushPlugin clearing badge
> 2018-05-18 15:26:09.683930+0300 myapp[1823:673535] Push Plugin register success: <942ac913 e1cfcb04 281a93c2 fd3e0075 15ba8bbf
> c19b6a31 e31e3908 972283c1>
> 2018-05-18 15:26:12.035832+0300 myapp[1823:673763] TIC Read Status [4:0x0]: 1:57
> 2018-05-18 15:26:12.035971+0300 myapp[1823:673763] TIC Read Status [4:0x0]: 1:57
> 2018-05-18 15:26:12.466602+0300 myapp[1823:673611] TIC Read Status [5:0x0]: 1:57
> 2018-05-18 15:26:12.466742+0300 myapp[1823:673611] TIC Read Status [5:0x0]: 1:57
这是关于push插件的代码
pushSetup() {
const options: PushOptions = {
android: {
senderID: "400528480580",
sound: true,
topics: ["androiduser"],
icon: "ic_stat_iconpush"
},
ios: {
alert: "true",
badge: true,
clearBadge: "true",
sound: "false",
topics: ["iosuser"]
},
windows: {},
browser: { pushServiceURL: "http://push.api.phonegap.com/v1/push" }
};
let topic = "iosuser"; //this way ,topics are working in android but not in ios
pushObject.subscribe(topic);
const pushObject: PushObject = this.push.init(options);
pushObject.on("notification").subscribe((notification: any) => {
alert(notification.title + ": " + notification.message);
});
pushObject.on("registration").subscribe((data: any) => {
this.userData.pushtokenSave(data.registrationId);
this.pushKaydet(data.registrationId);
});
pushObject
.on("error")
.subscribe(error => console.error("Error with Push plugin", error));
}