Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-08-2011, 01:38 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 104
Shades of Chaos is on a distinguished road
Default Changing user-agent

Hey guys,

I am trying to change my user agent like this
Code:
[req setValue:userAgent forHTTPHeaderField:@"User-Agent"];
Where userAgent is an NSString and it seems to work in the app because when I NSLog it it shows up as what I changed it to
Code:
NSLog(@"user agent = %@", [req valueForHTTPHeaderField: @"User-Agent"]);
But when I go to this site Whats My User Agent? the user agent is unchanged. Does anyone know why this could be.

Thanks
Clinton
Shades of Chaos is offline   Reply With Quote
Old 08-08-2011, 03:22 PM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Jan 2010
Location: Issaquah, WA
Age: 42
Posts: 1,244
dljeffery is on a distinguished road
Default

Do you mean, when you point the request you created in your iOS app at that site, you don't see your custom user agent info?

Or do you mean when you go to that site from Safari, you don't see your custom user agent?
__________________
Recall It! Tag your notes. Tag your photos. Tag your thoughts. Tag your life.

Recall It! for iPad

http://www.dljeffery.com
dljeffery is offline   Reply With Quote
Old 08-08-2011, 03:37 PM   #3 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 104
Shades of Chaos is on a distinguished road
Default

When I got to that site in safari I want to see my custom user agent
Shades of Chaos is offline   Reply With Quote
Old 08-08-2011, 03:58 PM   #4 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Jan 2010
Location: Issaquah, WA
Age: 42
Posts: 1,244
dljeffery is on a distinguished road
Default

That won't work. Safari uses its own user agent string. The user agent you set on a request in your app only works for that one request in your app.
__________________
Recall It! Tag your notes. Tag your photos. Tag your thoughts. Tag your life.

Recall It! for iPad

http://www.dljeffery.com
dljeffery is offline   Reply With Quote
Old 08-08-2011, 04:15 PM   #5 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 104
Shades of Chaos is on a distinguished road
Default

Ok thank you
Shades of Chaos is offline   Reply With Quote
Reply

Bookmarks

Tags
agent, change, header, http, user

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 406
16 members and 390 guests
7twenty7, blasterbr, chiataytuday, cristofercolmbos, dedeys78, dre, fiftysixty, gmarro, HemiMG, jimmyon122, jonathandeknudt, LEARN2MAKE, pungs, raymng, tymex, UMAD
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,669
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dedeys78
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:06 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0