<bdo id='46grS'></bdo><ul id='46grS'></ul>

    <tfoot id='46grS'></tfoot>
    1. <i id='46grS'><tr id='46grS'><dt id='46grS'><q id='46grS'><span id='46grS'><b id='46grS'><form id='46grS'><ins id='46grS'></ins><ul id='46grS'></ul><sub id='46grS'></sub></form><legend id='46grS'></legend><bdo id='46grS'><pre id='46grS'><center id='46grS'></center></pre></bdo></b><th id='46grS'></th></span></q></dt></tr></i><div id='46grS'><tfoot id='46grS'></tfoot><dl id='46grS'><fieldset id='46grS'></fieldset></dl></div>

      <small id='46grS'></small><noframes id='46grS'>

    2. <legend id='46grS'><style id='46grS'><dir id='46grS'><q id='46grS'></q></dir></style></legend>

      使用 NSURL 请求时出现错误的 URL

      时间:2023-10-03
            <tbody id='JsTgU'></tbody>

            <small id='JsTgU'></small><noframes id='JsTgU'>

          1. <i id='JsTgU'><tr id='JsTgU'><dt id='JsTgU'><q id='JsTgU'><span id='JsTgU'><b id='JsTgU'><form id='JsTgU'><ins id='JsTgU'></ins><ul id='JsTgU'></ul><sub id='JsTgU'></sub></form><legend id='JsTgU'></legend><bdo id='JsTgU'><pre id='JsTgU'><center id='JsTgU'></center></pre></bdo></b><th id='JsTgU'></th></span></q></dt></tr></i><div id='JsTgU'><tfoot id='JsTgU'></tfoot><dl id='JsTgU'><fieldset id='JsTgU'></fieldset></dl></div>

              <tfoot id='JsTgU'></tfoot>
              <legend id='JsTgU'><style id='JsTgU'><dir id='JsTgU'><q id='JsTgU'></q></dir></style></legend>
                <bdo id='JsTgU'></bdo><ul id='JsTgU'></ul>
                本文介绍了使用 NSURL 请求时出现错误的 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在尝试在 iPhone 4.0 SDK 中请求这种 URL(访问令牌稍作修改,因为您实际上并不需要查看它):

                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.com/me?sdk=ios&sdk_version=2&access_token=123902817987|8cb9e8408d2685cef853cd80.9-747882379|UGu5NvcAHiXuGEGzkq&format=json&limit=40&until=1286619821
                

                但我收到了这条消息:

                Failed with error: Error Domain=NSURLErrorDomain Code=-1000 "bad URL" UserInfo=0x9e657a0 {NSUnderlyingError=0x9e656a0 "bad URL", NSLocalizedDescription=bad URL}
                

                当我在 Safari 或 Chrome 中复制和粘贴时,它可以工作.我尝试按照建议将 | 替换为 %| here 但不起作用.

                When I copied and pasted in Safari or Chrome, it works. I tried replacing | with %| as suggested here but doesn't work.

                从终端询问它看起来像这样:

                Asking it from the terminal looks like this:

                curl https://graph.facebook.com/me/statuses?sdk=ios&sdk_version=2&access_token=9999955817987|8ab9e8408d2685cef.3-747882379|UGuxWDuM&format=json&limit=40&until=1286619821
                [1] 16190
                [2] 16191
                [3] 16194
                [4] 16195
                [5] 16196
                [2]   Done                    sdk_version=2
                [4]-  Done                    format=json
                $ -bash: UGu5NvcAHiXuGEGzkq3KP8xWDuM: command not found
                -bash: 8ab9e8408d2685cef853cd80.3-747882379: command not found
                {"error":{"type":"OAuthException","message":"An active access token must be used to query information about the current user."}}
                [1]   Done                    curl https://graph.facebook.com/me/statuses?sdk=ios
                [3]-  Exit 127                access_token=9999955817987 | 8ab9e8408d2685cef.3-747882379 | UGuxWDuM
                [5]+  Done                    limit=40
                

                有什么想法吗?

                推荐答案

                 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"];
                

                这篇关于使用 NSURL 请求时出现错误的 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何将 JSON 解析为 Objective C - SBJSON 下一篇:从 iPhone 应用程序以编程方式拨打电话并在结束通话后返回应用程序

                相关文章

                  <bdo id='AHZSu'></bdo><ul id='AHZSu'></ul>

                <i id='AHZSu'><tr id='AHZSu'><dt id='AHZSu'><q id='AHZSu'><span id='AHZSu'><b id='AHZSu'><form id='AHZSu'><ins id='AHZSu'></ins><ul id='AHZSu'></ul><sub id='AHZSu'></sub></form><legend id='AHZSu'></legend><bdo id='AHZSu'><pre id='AHZSu'><center id='AHZSu'></center></pre></bdo></b><th id='AHZSu'></th></span></q></dt></tr></i><div id='AHZSu'><tfoot id='AHZSu'></tfoot><dl id='AHZSu'><fieldset id='AHZSu'></fieldset></dl></div>

                  <tfoot id='AHZSu'></tfoot>
                1. <small id='AHZSu'></small><noframes id='AHZSu'>

                  1. <legend id='AHZSu'><style id='AHZSu'><dir id='AHZSu'><q id='AHZSu'></q></dir></style></legend>