Do you evaluate the SAP BTP SDK for iOS/Android and SAP Mobile Services with a trial account? Then you might have encountered an unexpected “Failed to logon!” error.
In this blog post, I will inform you about a limitation for the trial plan of SAP Mobile Services which might be the root cause of this error. I will also show you how to fix the issue and give a deeper explanation of when and why you can expect that this particular error occurs.
To explain the situation I am using my trial account as well as the SAP BTP SDK for iOS Assistant to create a sample application.
The Assistant will create an Xcode project but also creates an application definition in SAP Mobile Services.
If you encounter an expected “Failed to logon!” error I recommend checking the logs in SAP Mobile Services.
If you encounter the warnings
- “Registration count is beyond the account limit”
- “Failed to create auto device registration”
then the error is caused by the fact that the registration count exceeds the trial account limitation.
On the trial plan, Mobile Services does not allow more than 3 registrations per app.
Solution: if you encounter this error, delete the existing user registrations in Mobile Services to keep your registration count below the trial account limit.
In my example, I installed the same app on multiple iOS simulators and onboard the same user. Different iOS simulators will result in various registrations so it is no surprise that I encounter the error for the 4th onboarding.
I would have encountered the error also if I deleted and reinstalled the app multiple times on the same iOS simulator. But why? The answer is that the registration is calculated based on “Device ID” and “Username”. But there is no such thing as a stable “Device ID” provided by the iOS operation system. The SAP BTP SDK for iOS uses an alphanumeric string that uniquely identifies a device to the app’s vendor (identifierForVendor).
As the Apple documentation states
The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one or more of them.
The vendor identifier is calculated based on the app’s bundle ID. In my example the bundle ID is example com.sap.btpsdkios.AppConnectingToTrial
Therefore deleting and reinstalling the only app with a bundle ID starting with example com.sap.btpsdkios will cause a new “Device ID” and therefore a new registration.
I hope this blog post help helped you to understand the limitation better and how to circumvent the “Failed to logon!” error.