我有这个非常简单的代码:
PO(URLString);
url = [NSURL URLWithString:URLString];
PO(url);
NSData * data=[NSData dataWithContentsOfURL:url];
(PO()
是我打印东西的宏。)
它大部分时间都有效。这是输出:
2012-10-08 11:39:28.187 BadgerNew[2475:5007] <0x1f5321f0 BGCRBusinessForDisplay.m:(113)> URLString: http://id.openrice.com/UserPhoto/photo/0/U/0005Z29E131A230CBA4A42n.jpg
2012-10-08 11:39:28.193 BadgerNew[2475:5007] <0x1f5321f0 BGCRBusinessForDisplay.m:(115)> url: http://id.openrice.com/UserPhoto/photo/0/U/0005Z29E131A230CBA4A42n.jpg
2012-10-08 11:39:30.191 BadgerNew[2475:6b03] <0x1f529f00 BGCRBusinessForDisplay.m:(113)> URLString: http://maps.googleapis.com/maps/api/staticmap?&zoom=16&size=160x160&maptype=roadmap&sensor=true¢er=-6.187900,106.775429&markers=size:small|color:blue|-6.187900,106.775429
2012-10-08 11:39:30.196 BadgerNew[2475:6b03] <0x1f529f00 BGCRBusinessForDisplay.m:(115)> url: (null)
如您所见,它适用于http://id.openrice.com/UserPhoto/photo/0/U/0005Z29E131A230CBA4A42n.jpg并且在http://maps.googleapis.com/maps/api/staticmap?&zoom上失败=16&size=160x160&maptype=roadmap&sensor=true¢er=-6.187900,106.775429&markers=size:small|color:blue|-6.187900,106.775429
也许问题是 | 在 Google 网址中。那么我该怎么办呢?