our iOS application was recently rejected by Apple because it could not establish a valid connection to our api server. We use a specially formatted user agent to register a device token and so on. If the user agent does not fit into our sheme, api blocks the request.
All this very well tested the application on a simulator, as well as on a real device. The user agent was configured correctly and worked with the api.
As Apple tested the application, they rejected it because the application could not connect to the api. When we checked the server log files, we noticed that each request sent by Apple testers had a completely different user agent than the one we installed in the code.
(correct) user agent that was installed when testing the application:
AppName-App/010002 iOS/8.1.2 on Apple iPhone/DeviceToken
(invalid) user agent as it appeared in our logs:
AppName/1.0.0.2 (iPad; iOS 8.1.3; Scale/2.00)
The application uses AFNetworking and installs its user agent as follows:
ConnectionManager.requestSerializer.setValue(IOSREQUESTHEADER, forHTTPHeaderField: "user-agent")
Do you have an idea why this does not work when Apple tests the application while it is completely fine when we do?
Best wishes
ios swift afnetworking afnetworking-2
Marco butz
source share