Problem calling a Local HTML File from XCode

南楼画角 提交于 2019-12-01 12:16:39

Check that the file is copied to your application bundle. When [[NSBundle mainBundle] pathForResource:ofType:] returns nil very most likely there is no file with this name in the bundle

In Xcode3 right click the "Groups & Files" header in the side bar and select "target membership". Make sure the checkbox in front of index.html is checked.

URLs have to define how to obtain information, not just what the file is called. This means you have to specify the full URL, like http://www.something.com/index.html or file:///Users/Daniel/Sites/index.html. What you are specifying is a URI not a URL

For the difference between a URL and URI: http://www.damnhandy.com/2007/11/19/uri-vs-url-whats-the-difference/

Apple docs for NSURL: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/Reference/Reference.html

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