开发者

How to use local xml saved in my project??

开发者 https://www.devze.com 2023-03-23 16:47 出处:网络
Hey the server which i am using is too slow to respond while using Maps, so i decide to ship my xml with the app and storing it locally in the app. How should i go about using it??

Hey the server which i am using is too slow to respond while using Maps, so i decide to ship my xml with the app and storing it locally in the app. How should i go about using it??

T开发者_StackOverflowhanks,


Use [[NSBundle mainBundle] pathForResource:@"myfile" ofType:@"xml"] to get the path. From there you can use NSData, NSString, or other classes to load the data.


You have not properly implemented the pathForResource:

NSString * string = [[NSBundle mainBundle] pathForResource"@"list-50.xml" ofType:@"xml"]; 

This is wrong.

So it should be

NSString * string = [[NSBundle mainBundle] pathForResource:@"list-50" ofType:@"xml"]; 
0

精彩评论

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