Tom Andersen
Tom Andersen

Reputation: 7200

XCode: How do I delete the debug app on the iPhone without erasing all documents?

I have found that XCode does not erase files that you remove from a project when it copies over the newly compiled application.

I have a uiviewcontroller. It used a .xib file. Then decided to not use a .xib file, and removed it from my computer. But when I run the app (even after pressing 'clean') the MyUIviecontroller.nib file is still in the app bundle and causes problems. Plus one can think of all sorts of other issues.

What would be ideal is to simply completely erase the application only, leaving the documents and preferences folder. You can delete the documents folder in XCode in the Organizer, and on the simulator I can delete files any where i want.

Upvotes: 0

Views: 1830

Answers (2)

rob mayoff
rob mayoff

Reputation: 385890

Find your app on your device in the Xcode Organizer. Xcode will let you download the app's data, including the documents and preferences, as an xcappdata bundle. Then erase your app entirely from the device and install the new version. finally, use the Organizer To upload the xcappdata bundle back to the device.

Upvotes: 1

Live2Enjoy7
Live2Enjoy7

Reputation: 1105

Not sure if preferences folder is writeable (I don't think it is, only documents and caches directories).

But for documents folder, you can use NSFileManager contentsAtPath method to get an NSData object. Then convert this data into a string and send it to a server where you can get it from later. (as described in this post: Upload Data To Server IPhone)

When you reinstall your app, you can get the string, convert to nsdata and write back to Documents.

A bit of a pain, but could possibly work if your really need it.

Upvotes: 0

Related Questions