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
精彩评论