我想使用bit.ly跟蹤我的iTunes聯盟鏈接。 我從http://target.georiot.com獲得聯盟鏈接。 它操作時,直接鏈接(去iTunes)。 但是,當我縮短聯屬營銷鏈接,它不會在同一頁上。IOS會員鏈接縮短bit.ly不工作
這裏是獲取縮短網址的代碼:
NSString *longURL = link;
NSString *bitlyRequestURLString = [NSString stringWithFormat:@"http://api.bit.ly/shorten?version=2.0.1&format=xml&login=%@&apiKey=%@&longUrl=%@",
@"myappname",
@"myappidentifier",
longURL];
NSURL *bitlyURL = [NSURL URLWithString:bitlyRequestURLString];
// get the short URL from bit.ly
NSError *error;
NSString *response = [NSString stringWithContentsOfURL:bitlyURL encoding:NSUTF8StringEncoding error:&error];
NSString *shortURL = @"";
NSArray *responseParts = [response componentsSeparatedByString:@"<shortUrl>"];
if ([responseParts count] > 1) {
NSString *responsePart = [responseParts objectAtIndex:1];
responseParts = [responsePart componentsSeparatedByString:@"</shortUrl>"];
if ([responseParts count] > 0) {
shortURL = [responseParts objectAtIndex:0];
}
}
末重定向鏈接進入成才:象 「http://phobos.apple.com/WebObjects/......」
任何想法? 感謝
最後的重定向鏈接對我來說很合適。它怎麼錯了? – 2012-02-22 21:29:34
當它發送到iTunes時,它不會在期望的頁面上 – user1078065 2012-02-22 21:34:56
什麼是期望的頁面?不在apple.com上的東西? – 2012-02-22 21:37:58