欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

ReadPlist

程序员文章站 2022-06-05 08:44:10
nsarray *cachepath= nssearchpathfordirectoriesindomains(nscachesdirectory, nsuserdomainmas...

nsarray *cachepath= nssearchpathfordirectoriesindomains(nscachesdirectory, nsuserdomainmask, yes);

    nsstring *cachedir = [cachepath objectatindex:0];

    nsstring *filepath = [cachedir stringbyappendingpathcomponent:@"version.plist"];

 

    nsfilemanager *filemanager = [nsfilemanager defaultmanager];

    // copy the file from the resourcepath to the documentpath

    if (![filemanager fileexistsatpath:filepath]) {

        nsstring *databasepathfromapp = [[[nsbundle mainbundle] resourcepath] stringbyappendingpathcomponent:@"version.plist"];

        nserror *error;

        [filemanager copyitematpath:databasepathfromapp topath:filepath error:&error];

    }

 

   
    nsdictionary *dic=[nsmutabledictionary dictionarywithcontentsoffile:filepath];