ios - "unsupported URL"从 FBSDKGraphRequest 获取照片时
<p><p>我正在尝试通过图形 API 从 Facebook 获取照片。当我在 Graph api 中尝试这个 url 时,它可以工作,但在我的代码中不起作用。我收到以下错误:</p>
<blockquote>
<p>Domain=kCFErrorDomainCFNetwork Code=-1002 "unsupported URL"
UserInfo={NSErrorFailingURLStringKey=(null)?</p>
</blockquote>
<p>我的代码如下</p>
<pre><code>let fbRequest = FBSDKGraphRequest(graphPath: "227325594139454?fields=photos.limit(10){images}", parameters: nil)
let graphConnection = FBSDKGraphRequestConnection()
graphConnection.addRequest(fbRequest, completionHandler: { (connection:FBSDKGraphRequestConnection!, result:AnyObject!, error:NSError!) -> Void in
if(error != nil){
}
else
{
})
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>很简单 url 不支持 "{}"所以,只需替换 "{"和 "}"的 html 代码就可以了。所以“{”会变成<strong>%7B</strong>,“}”会变成<strong>%7D</strong>。</p>
<pre><code>let fbRequest = FBSDKGraphRequest(graphPath: "227325594139454?fields=photos.limit(10)%7Bimages%7D", parameters: nil)
</code></pre></p>
<p style="font-size: 20px;">关于ios - "unsupported URL"从 FBSDKGraphRequest 获取照片时,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/33235128/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/33235128/
</a>
</p>
页:
[1]