Bad URL when requesting with NSURL

后端 未结 4 1819
一生所求
一生所求 2020-12-01 19:44

I\'m trying to request this kind of URL in iPhone 4.0 SDK (access token slightly modified because you don\'t really need to see it):

https://graph.facebook.c         


        
相关标签:
4条回答
  • 2020-12-01 20:02

    You need to replace the pipe character in the URL with %7C. This is the URL encoded value.

    Also, the URL needs to be enclosed in quotation marks in order for it to work with curl.

    0 讨论(0)
  • 2020-12-01 20:03
     NSString *strURL = [loc_address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    
                // requesting weather for this location ... 
                NSMutableURLRequest *req = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat: @"http://www.google.com/ig/api?weather=%@", strURL]] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:5.0];
                [req setHTTPMethod:@"POST"];
                [req addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
    
    0 讨论(0)
  • 2020-12-01 20:05

    ho ho ho.

    Set location_id using the id of the venue you want.

    This make me waste a lot of time.

    One of dozen facebook secrets is debug network when making what you want, in this case creating a event. You'll see the correct params names for what you need.

    0 讨论(0)
  • 2020-12-01 20:07

    This error message, also can be caused by any error in the URL typing. Usually some white space in the URL string.

    0 讨论(0)
提交回复
热议问题