引用NSURL中的字符串 [英] Referencing a string inside an NSURL

查看:89
本文介绍了引用NSURL中的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在此NSURL中使用此字符串,但是我认为它不正确,从而给我一个ASI HTTP请求失败错误.

I'm trying to use this string inside this NSURL however I don't think its right and in turn giving me an ASI HTTP request failed error.

NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://furious-ice-356.heroku.com/places/%@/reviews.xml",self.identifier]];

推荐答案

self.identifier返回(在大多数情况下)类型为id的对象.您不能将此对象投射到NSString*.

self.identifier returns (in most cases) an object of the type id. You cannot cast this object to a NSString*.

唯一的例外是NSUserInterfaceItemIdentification协议中10.7新引入的NSString*identifier属性.

The only exception is the in 10.7 newly introduced identifier property of NSString* in the NSUserInterfaceItemIdentification protocol.

您能否详细说明问题,以便我们了解self具有什么类型?

Can you elaborate your question so we can see what type self has?

这篇关于引用NSURL中的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆