iPhone:无法创建 URL
我正在使用 facebook apis
我正在尝试获取 id 为“105502842870274”的图像的属性,为此我尝试创建一个像这样的 url
NSString *firstComponent=@"https://graph.facebook.com/105502842870274?access_token=";
firstComponent=[firstComponent stringByAppendingFormat:[NSString stringWithFormat:@"%@",_accessToken]];
NSURL *url = [NSURL URLWithString:firstComponent];
,但每次 url 都传递为 nil。
如果我做错了什么或建议其他方式来获取图像的属性,请告诉我。
提前感谢
I am working with facebook apis
I am trying to fetch attributes of an image with id '105502842870274' for this I tried to create a url like this
NSString *firstComponent=@"https://graph.facebook.com/105502842870274?access_token=";
firstComponent=[firstComponent stringByAppendingFormat:[NSString stringWithFormat:@"%@",_accessToken]];
NSURL *url = [NSURL URLWithString:firstComponent];
but every time url is passes as nil.
Please let me know if I am doing something wrong or suggest someother way to fetch attributes of an image.
Thanx in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这将解决您的问题。其html编码问题。
另请参阅:参考页面
this will resolve your issue. Its html encoding problem.
also look: reference page
试试这个
try this
你只是做得太复杂了,而且你在额外的代码中犯了错误。
您使用了
stringByAppendingFormat
而不是stringByAppendingString
。对于更简单的解决方案,只需执行以下操作:
或者如果您想稍后访问该字符串:
You're just doing it too complicated, and it is in your extra code that you made an error.
You used
stringByAppendingFormat
instead ofstringByAppendingString
.For an even easier solution, just do :
Or if you want to access the string later :