开发者

stringWithContentOfURL return an empty string

i have a problem with the method "[NSStrng stringWithContentOfURL:url]"; all thing开发者_运维百科s worked so fine until i change my url from a web address to an ip address with which i got an empty string. Did you have a solution or an idea? Thks


Use a method that returns an error status (e.g. +stringWithContentsOfURL:encoding:error:) and check the error return.


update: NSCocoaErrorDomain Code=256 is "NSFileReadUnknownError", which means "file read error, reason unknown" (not very helpful). Probably there's something wrong with the URL (misspelled pathname, wrong IP address, etc.)

Numeric IP addresses most definitely are supported in URLs, so that's not the problem.

see also iPhone - dataWithContentsOfURL: does not work for some URLs

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜