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
- Database Fetching Problem Swift
Hello there π I am using Swift and connected to the Appwrite database. I can create new entries. However, when I try to retrieve an entry, I never get the entr...
- Swift ios login not working
As title says I can't seem to login it creates the session sucessfully at first as seen here, but fails when try to run account.get() Do i need to manuelly sav...
- Not able to openasyncauthsession in goog...
I'm trying to implement google oauth from appwrite in my expo app, the sign in works fine in expo go mobile app but it says [Error: Failed to login. Unable to o...