开发者

stringWithContentOfURL return an empty string

开发者 https://www.devze.com 2023-01-20 03:08 出处:网络
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

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

精彩评论

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