简体   繁体   中英

How to remove old build files from an existing app install/bundle?

I recently found a problem in my Compile Sources Build Phase, it was compiling MyDB.xcdatamodeld and MyDB.xcdatamodel into the build (probably left over from some migration between Xcode versions or something). This wasn't a problem until I recently started using a library that uses:

[NSManagedObjectModel mergedModelFromBundles:nil]

Which goes and finds both of the MyDB files and throws an error that it can't merge duplicate entities, similar to this issue Core Data: Error, "Can't Merge Models With Two Different Entities Named 'foo' " . The problem w/their solution though is that it involves deleting the app :)

I fixed the problem in my Build Phase (I removed the MyDB.xcdatamodel line) and if I do a fresh install of the app it works fine, but if I install the app over an existing install (ie an update) then I still get the same DB error about duplicate entities. I imagine this is because the MyDB.xcdatamodel file is still hanging out in the user's bundle.

So my question is: how can I remove this file from existing install's bundles?

I believe old files get left behind only when you install an application during development through Xcode. Try testing an upgrade done through ad hoc distribution instead, you shouldn't see this problem.

Clean all your targets and delete the app on the simulator/device? :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM