SORU
7 EKİM 2009, ÇARŞAMBA


NSURLConnection bu userAgent değiştirme

Hey veri almak için NSURL bir Bağlantı kullanıyorum.

[NSURLConnection sendSynchronousRequest:
//create request from url
[NSURLRequest requestWithURL:
  //create url from string
  [NSURL URLWithString:url]
] 
//request parameters
returningResponse:nil error:nil
]

Kullanıcı Aracısı dizesi değiştirmek mümkün müdür? şimdi sağ:

AppName/AppVersion/459/10.0.0 Darwin CFNetwork.d3

CEVAP
7 EKİM 2009, ÇARŞAMBA


NSString* userAgent = @"My Cool User Agent";
NSURL* url = [NSURL URLWithString:@"http://whatsmyuseragent.com/"];
NSMutableURLRequest* request = [[[NSMutableURLRequest alloc] initWithURL:url]
                                autorelease];
[request setValue:userAgent forHTTPHeaderField:@"User-Agent"];

NSURLResponse* response = nil;
NSError* error = nil;
NSData* data = [NSURLConnection sendSynchronousRequest:request
                                     returningResponse:&response
                                                 error:&error];

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Caramthros

    Caramthros

    10 AĞUSTOS 2007
  • JonnyEthco

    JonnyEthco

    5 EKİM 2006
  • RaquelGamesBR

    RaquelGamesB

    20 HAZİRAN 2009