Comments (31)
UPDATE: This appears to only be an issue in a production environment. iOS 13 receives and processes the notifications as expected when testing in a development environment.
from stream-chat-swift.
CORRECTION: tracing back a little further, I see that it might not be an APNS issue. The failure is that the new message event isn't getting through the app. In this case ChannelPresenter calls Notifications.shared.showIfNeeded(newMessage: message, in: channel) upon a .messageNew event. This is not happening on iOS 13 in production. Is the StreamChatCore SDK intercepting notifications somewhere other than the Notifications class?
from stream-chat-swift.
Hi @jbcaveman
Could you check that you uploaded a production push notification certificate on our dashboard?
from stream-chat-swift.
Yes. I am using a .p8 key. When I noticed the issues, I also tried to revert back to our active production .p12 that we use with another service, but I didn't see a change. I also tried generating a new .p8 key, which had no effect.
from stream-chat-swift.
Did you check push logs in our dashboard?
from stream-chat-swift.
Just checked it. I guess the logs take a while to populate because I wasn't seeing any yesterday. Today I do see them and I see success for the iOS 13 user. So it would appear that the notifications are sent, but they are not populated through the app when it is active or in background.
from stream-chat-swift.
A push notification will be sent if the client was disconnected. When the app is going to the background the client will keep connection for a 1-5 min. Can you test when the app in the background for more than 5 min?
from stream-chat-swift.
Can you send to our support your issue and api key?
from stream-chat-swift.
I did notice the push will send if I wait for a minute or so. So I suppose the issue lies with the client handling of the event in iOS 13. I will pick this up with a support email. Thanks.
from stream-chat-swift.
@jbcaveman Now it looks like local notifications doesn't work for you. But now you can debug.
So, when your app in the background and the client still connected the client will send local notifications.
Try to enable logs for notifications Notifications.logsEnabled = true
and test a new message when the app in the background.
from stream-chat-swift.
Here are some production logs where the app is not showing the updates in the ChannelsViewController. I can see the message data in the log and the tab & app badge will increment, but the ChannelsViewController does not update with the new messages.
background_log.txt
active_log.txt
from stream-chat-swift.
And here are development environment logs where the app is showing all updated messages normally. Notice the custom logging showing calls to "apns: Notifications: show(newMessage...)" in these logs that don't show up in the production logs.
background_log_dev.txt
from stream-chat-swift.
Are you debugging production build?
from stream-chat-swift.
Thanks for logs!
from stream-chat-swift.
Just updated the dev background log, going back a bit more to the app entering background mode.
The production app is a Release build.
The dev app is a Debug build.
from stream-chat-swift.
I know build types. I'm curious how you get Stream logs from production? Did you override ClientLogger log function?
from stream-chat-swift.
It's really weird. Did you try to compile and debug the production build? Does it have the same logs?
from stream-chat-swift.
I'm copying the logs from the Xcode console with
Client.config = .init(apiKey: STREAM_KEY, logOptions: .all)
Notifications.shared.logsEnabled = true
The behavior is the same as the live app in the app store.
from stream-chat-swift.
Yes, that's what I'm asking.
from stream-chat-swift.
I have a remote logging feature that I can put into a true production release and install through TestFlight. It will take a few minutes. I'm not sure it will catch the Stream logs, though.
from stream-chat-swift.
Is notifications authorization status ok at the beginning?
Can you send me full logs?
ClientLogger
has a callback
public static var logger: (_ icon: String, _ dateTime: String, _ message: String) -> Void
You can override the default behavior print
to something else.
from stream-chat-swift.
When you tested the dev build, a chat view controller was opened?
from stream-chat-swift.
I have the app opening a ChannelsViewController at launch because that is the only way I found to kick start all notifications properly.
My logger gets all stdout, so it is catching your logs. I'll publish a TestFlight app with this turned on to get as close to a real production experience as possible.
Meanwhile, here is a full production log when run using xcode. The notifications appear to be set right at launch.
from stream-chat-swift.
In the last logs I don't see background work.
from stream-chat-swift.
Ok. I was able to do the same test with the same results from a production TestFlight app. I sent messages while active, in background, and while channels view is up and while chat view is up. The messages tell the state of the receiving app. Here are the logs
log_stdout.txt
log_stderr.txt
To be thorough, here is the Notifications extension I altered to get the active and background alert working. Again, this works in all cases except iOS 13 in production, apparently because the .messageNew event doesn't reach the ChannelPresenter(s) owned by ChannelsViewController.
Notifications_extension.txt
from stream-chat-swift.
I’ve just found an article with push notifications changes for iOS 13.
https://onesignal.com/blog/ios-13-introduces-4-breaking-changes-to-notifications/
Probably needs to update push notifications template. Needs to add: apns-push-type: alert
Could you try?
from stream-chat-swift.
I thought that was a header requirement rather than a part of the payload, but I will try that out.
from stream-chat-swift.
I actually noticed some negative effects when adding that to the payload like {"aps":{...},"apns-push-type":"alert"}. And adding it like {"aps":{...,"apns-push-type":"alert"}} had no effect. According to this document, this is a header field.
Is there a way to add headers through the CLI? I tried "--apns-push-type 'alert' " but that of course threw an error.
from stream-chat-swift.
No worries. Looks like we should fix it on our backend side. I told our backend team to check headers. Probably will be fixed tomorrow on CET time.
from stream-chat-swift.
Thanks so much for working through this!
from stream-chat-swift.
@jbcaveman Push notifications for iOS13 should work now.
from stream-chat-swift.
Related Issues (20)
- Token provider keeps retrying after calling disconnect HOT 5
- Passing an Invalid Token during connection triggers an infinity loop. HOT 3
- Unable to receive push Notifications: error "DeviceTokenNotForTopic" HOT 2
- Missing super.init in AsyncOperation HOT 2
- Error "'shared' is unavailable in application extensions for iOS..." when using UNNotificationServiceExtension HOT 1
- App crash on creating a new 1:1 chat, found nil when unwrapping optional in ListDataBaseObserver HOT 26
- Composer text input not resizing correctly HOT 6
- Message author miscomputed after user id change during the same session HOT 3
- Multiple didUpdateChannel with unreadCount 0 HOT 23
- Upload Image to GetStream CDN HOT 1
- See Original and Translated Message HOT 6
- Message Search Not Working HOT 11
- Custom subview of ChatMessageContentView is not sized correctly HOT 5
- TokenProvider not triggering refresh and causing infinite API calls HOT 5
- Is it possible for me to query a channel to direct message only? HOT 1
- Test
- Mute intervals for channels doesn't seem to work HOT 4
- Extra Data not able to search using contain key it alway give blank response (UserListFilterScope) HOT 2
- Message Search Not Working HOT 1
- Search Channel By User Name HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stream-chat-swift.