1
Nsarray *paths=nssearchpathfordirectoriesindomains (NSDocumentDirectory, Nsuserdomainmask, YES);
NSString *path=[paths objectatindex:0];
NSString *dest=[path stringbyappendingpathcomponent: @ ""];
NSLog (@ "%@", tmpcontent);
[Self loadhtmlstring:tmpcontent baseurl:[nsurl fileurlwithpath:dest];
Explanation of the above red font:
If you use stringbyappendingstring, you need to manually add the "/" symbol to the name, and stringByAppendingPathComponent does not, it will be added automatically
The difference between stringbyappendingpathcomponent and stringbyappendingstring:
NSString *imagepath = [Skinpath stringbyappendingstring:[nsstring stringwithformat:@ "/%@" , ImageName]]; // stringbyappendingstring is the meaning of the suffix in Skinpath NSString *imagepath = [Skinpath stringbyappendingpathcomponent:imagename]; // stringByAppendingPathComponent is to add a "/" sign to the Skinpath after the imagename to make it the full path NSLog (@ "imagepath:%@", ImagePath);
Print:
2013-11-27 14:44:30.052 willing[2757:70b] imagepath:/users/will/library/application Support/iPhone Simulator/7.0.3/ Applications/da5b603d-4d07-4425-b7cc-5d49232189be/willing.app/tabbar_home.png
Summary of iOS knowledge points