Comments (14)
I'm going to close this as it looks like there's a workaround and if you're having issues you should create an issue at https://github.com/kylebrowning/APNSwift
from apns.
This is the workaround which work for me
request.apns.send(rawBytes: payload,
pushType: APNSwiftConnection.PushType.background,
to: apnsToken,
expiration: nil,
priority: nil,
collapseIdentifier: nil,
topic: nil,
logger: request.logger,
apnsID: nil)
from apns.
Hi @MacFriis did you enable the background+remote notifications in the background modes?
which is different from the capability of push notification
from apns.
Hi @idelfonsog2, yes I have had this on all along, and I have made a lot of Remote Notification on Apple devices using other libraries for C#, and finished services where I can get the "content-available" to work without having a message within the notification.
I can't see what I'm doing wrong if it is working in the library.
from apns.
This is probably better suited to https://github.com/kylebrowning/APNSwift as this package just proxies directly to that and that package does the actual sending.
Any idea on why this may be happening @kylebrowning ?
from apns.
Yup. This should be handle upstream. I’ll take a look!
from apns.
+1, running into this while porting a service from Python/PyAPNs2 to vapor/apns
from apns.
@MacFriis FWIW using apns.send(rawBytes: ...) works for me, instead of apns.send(payload: ...) or apns.send(notification: ...)
from apns.
@magnolialogic I'll give it a try
from apns.
@magnolialogic can you please send example code how you were able to send an update notification using rawBytes
? I wasn't able to do so with code below.
Payload:
"{
"aps" : {
"content-available" : 1
}
}"
request.apns.send(rawBytes: payload,
pushType: APNSwiftConnection.PushType.alert,
to: apnsToken,
expiration: nil,
priority: nil,
collapseIdentifier: nil,
topic: nil,
logger: request.logger,
apnsID: nil)
EDIT: Got this working by using APNSwiftConnection.PushType.background
although testing of this feature on iOS is really tricky.
from apns.
Can anyone share the code for the workaround? Can't seem to get it working.
from apns.
Sorry, I have abandon the servicer side swift all together... now back on dotnet 6
from apns.
Thank you so much @marekpridal for sharing.
Mine was the followoing:
private func sendPushes(_ tokens: [String], alert: APNSwiftAlert , on req: Request) async throws {
...
for token in tokens {
do {
try await req.apns.send(payload,
pushType: .alert,
to: token,
with: JSONEncoder(),
expiration: Date().addingTimeInterval(3600),
priority: 10,
collapseIdentifier: nil,
topic: applicationTopic,
logger: req.logger,
apnsID: apnsID).get()
...
// to complete
from apns.
let payload = APNSPayload(hasContentAvailable: true)
let acme = AcmeNotification(acme1: "hey", acme2: 2, aps: payload)
try! await req.apns.client.send(acme, pushType: .background, to: dt, priority: 5)
this worked for me.
from apns.
Related Issues (20)
- A new connection to APN server created for each request. HOT 15
- Allow swapping of configurations HOT 6
- Mock client for testing HOT 4
- Tag a new relaease? HOT 1
- Connection deadlock after random time HOT 6
- Connection timed out deadlock issue HOT 6
- Jan 9 HOT 2
- Bundle GeoTrust Global CA certificate HOT 1
- Support for sending PushNotifications via ProxyServer HOT 7
- Pass `Request.logger` as default logger parameter HOT 3
- Getting invalidProviderToken HOT 1
- Feature Request: How to register the APNSClient with Application? HOT 1
- Update to 4.0.0-beta.2 not working HOT 3
- APNS package not found HOT 3
- Cannot find 'APNSAlertNotification' in scope HOT 1
- Unable to Instantiate APNSClientConfiguration with tls certificate as in doc HOT 3
- The operation could not be completed. (APNSCore.APNSError error 1.) HOT 6
- Use Data, not ByteBuffer HOT 1
- Doesn't work with certificates HOT 2
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 apns.