美文网首页
swift 真机和模拟器plist地址不一样!!!!

swift 真机和模拟器plist地址不一样!!!!

作者: chinwy | 来源:发表于2016-11-10 17:27 被阅读24次


    func getDataFromPlist() {
        let home = NSHomeDirectory() as NSString
        let docPath = home.stringByAppendingPathComponent("Documents") as NSString
        let filePath = docPath.stringByAppendingPathComponent("convData.plist")
        print(filePath)
        let myConv = NSMutableArray(contentsOfFile: filePath)!
        listConv = myConv
        print(listConv)
    }
    
    func writeDataToPlist(listCov : NSMutableArray)  {
        let home = NSHomeDirectory() as NSString
        let docPath = home.stringByAppendingPathComponent("Documents") as NSString
        let filePath = docPath.stringByAppendingPathComponent("convData.plist")
        listConv.writeToFile(filePath, atomically: true)
        let newListConv = NSMutableArray(contentsOfFile: filePath)!
        print(newListConv)
        
    }

相关文章

网友评论

      本文标题:swift 真机和模拟器plist地址不一样!!!!

      本文链接:https://www.haomeiwen.com/subject/zlexpttx.html