Abhijeet_dce
Abhijeet_dce

Reputation: 85

Distinguish between nsurlrequest from iphone and ipad

I have two apps on App-store. one for iPhone and one for iPad with same name.

Now when i am making an API call request to get some data from my servers from these two apps, i collect there user agent on server side.

User agent comes in two form:

  1. If API call request made from NSUrlconnection useragent : / xyz....
  2. If made from uiwebview: Mozilla('iphone or ipad').

Now for second case , i have no issue in distinguishing between iPhone/iPad.

But for case of NSURLConnection request both have same and cant rely on

Any other distinguishing parameter can i get from user agent ?

both app are live right now ?

Upvotes: 0

Views: 67

Answers (1)

Crazy Developer
Crazy Developer

Reputation: 3464

When you create object of NSMutableURLRequest you need to add user agent using the below line.

NSString* userAgent = (is_iPad) : "iPad " ? "iPhone";

[request setValue:userAgent forHTTPHeaderField:@"User-Agent"];

here is_iPad is bool value contain true if app is running in ipad else false.

Upvotes: 1

Related Questions