Referencing a string inside an NSURL

▼魔方 西西 提交于 2020-01-06 14:20:54

问题


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

回答1:


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

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

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



来源:https://stackoverflow.com/questions/8114599/referencing-a-string-inside-an-nsurl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!