
I am trying to send push notification through APNS. I tried sending message from apple's push service console and it showing message. But when i try to send message through appwrite i am getting this Failed sending to target "DeviceToken" with error: The registration token is not a valid FCM registration token In the photo it should have shown APNS in provider but is not showing. This is the code: func loginUser(email: String, password: String) async -> RequestStatus { do { _ = try await account.createEmailPasswordSession(email: email, password: password)
guard let token = UserDefaults.standard.string(forKey: "apnsToken") else {
return .error("Failed to get APNS token")
}
guard let target = try? await account.createPushTarget(
targetId: ID.unique(),
identifier: token
) else {
return .error("Failed to create push target")
}
UserDefaults.standard.set(target.id, forKey: "targetId")
DispatchQueue.main.async {
self.isLoggedIn = true
UserDefaults.standard.set(true, forKey: "isLoggedIn")
}
return .success
} catch {
return .error(error.localizedDescription)
}
}
Recommended threads
- Appwrite documents and Swift codable
The object I use to create a document is different than the object I receive when I list documents. Do I create an object that’s used to create a document and a...
- Swift: Response from .deleteDocument
According to the docs, in Swift when calling `databases.deleteDocument` the response is supposed to be 204 (No Content). However, we are finding the response is...
- Project Setup
Hi Appwrite Community. I would like to set up my Xcode Project with the Appwrite SDK. I can't get it to work. I hope somebody can help me with this. Thanks 🙂 ...
