putpkt: Error and testing Core-Data Lightweight migration - iphone

I have an xcode project that has 4 targets (2 apps, 1 iPhone and 1 iPad version for each). I have recently implemented Core Data Lightweight Migration.
I am currently only testing two of the apps, the iPhone versions, call them App A and App B. I am able to run the current app store version of App A on my iPhone, then install my new version of App A to test the Lightweight Migration. It works fine, no problem.
Then, I try the same thing with App B. I am able to install the current app store version of App B on my iPhone no problem. BUT, when I try in install the new version of app B on my iPhone, I get the following error (or a variant of it) EVERY time: "putpkt: write failed, broken pipe"
I am confused since the two current versions are in the same project and have the exact same settings for every configuration (debug, release, distribution). The is not ad-hoc distribution.
Every post I have read for this error on this forum, and anywhere, suggests things like removing the app, restarting the device, restarting xcode, etc. And sure, I can get it to work that way. BUT I cannot test my migration that way.. If I remove the old version of the app from the device nothing is getting migrated!
I am pulling my hair out over this. The two apps were originally in two different projects, and I added App B to the App A project as a new target - that is the only thing I can think of, as I feel like I have looked at everything. I would really appreciate some help to figure out this problem. I feel sick about sending out a database update that I cannot test - I can't take the chance of corrupting people's data, especially when I have not offered a backup option until this current version. Ugh.
EDIT: when I try to run App B on the device without updating, I often get the following error:
Error Starting Executable... Don't know how to run. Try "help target".
EDIT: I think I am having this trouble because I renamed the product name for app B. I think this changed the bundle and will not allow me to migrate data. I will try to change it back and post an update. It seems like merge bundles IS working well for app A in the meantime.

Making sure the new project and the original project had the same product name and the same data model name fixed this problem for me.

Related

How to simulate the AppStore update process on device/simulator

We have submitted an update version of our existing applications in the App Store recently. But we have received a issue from one of the users, saying that the app is not functioning properly after the update. So in order to replicate the same, what are the steps to reproduce, so that i can analyse the issue?
Any help will be appreciated.
To simulate this before pushing yoru updated version to the AppStore you can:
Download the old version of your app from the appstore
Run the updated version of your app from XCode on the same device.
What will happen behind the scenes is that your app will be updated in a way similar to the Appstore. Your app will be partially updated while your doucments folder will stay the same. (what usually causes problems)
This solution is better because it lets you check for problems before and update was pushed to the Appstore.
Yeah, I get this a lot. The solution is a bit annoying, but you need to keep a history of IPAs you've submitted so you can put the on your phone through iTunes (so not the simulator) and then, run your code on your device putting a breakpoint on your applicationDidFinishLaunching handler in your app delegate, and start tracing from there. You should be able to find the old app store version in your organiser from the last time you submitted, or, go through your SVN/GIT history and checkout the version tagged to your release version.
Many times in the past that has happened to me where I test a new revision and everything looks fine but when I submit an update and is approved, users start complaining about a crash or lost data.
This is way I approach the problem.
(This is most important step) You need to either have your old code or old binary installed on your actual apple device. (Physical iPhone / iPad)
Now go to iTunes and install your new update.
Attach your physical iPhone / iPad to you computer, Launch Xcode and start debugging it.
NOTE: There have been many times when things work perfectly in the Simulator but break on the actual device. Its always important to test your code on the real thing as that is what the users are going to be on.
All that is required is to have the version of the app that is in the app store on your device, then install the updated version to your device. You can debug it using Xcode when you install the new version.

Problem in updating app on iPad

I created an app for iOS 3.2 for the first version 1.0.
Recently I created an updated app for iOS 4.2 with print feature etc. for the second version.
My problem is that, the users are not able to update the app from appstore.
They are facing issues like data loss of version 1.0 app, crashing etc.
Can someone explain me what can be the reason for this?
And, how can I test this thing on my device, as I am not having the version 1.0 app from appstore, but the code for both versions.
Delete your new one on your test device and install the old one. Then build and debug the new one line by line. I had lots of trouble my first time through due to confusion over the update/migration process of core data. If you use core data, chances are your existing customers have an out of date store DB that your new code is crashing on. The store doesn't get wiped in an update if it's in your user's document directory... Only the one in the app bundle. You'll need to handle that reset or tell core data to migrate it to the new model. Of course, all this is speculation since you've given almost no details about the problem, frameworks used, log files, etc.
During a normal install process, data should not be overwritten. NSUserDefaults and files should remain during an upgrade, as long as the user doesn't delete the app first. I assume the crashing occurs after the new version is installed?

How to get rid of old Localizable.strings?

So I have this app that is already on the app store. To get support for multi language localization we recently changed the localization configuration.
Old configuration:
./Localizable.strings
New Configuration:
./Swedish.lproj/General.strings
./Swedish.lproj/Localizable.strings
./Swedish.lproj/Settings.strings
If I remove the old version and install the new one everything works as expected, but if I leave the old version on the phone when I install the new one, the translations in ./Swedish.lproj/Localizable.strings won't be visible. So it seems to me like the old ./Localizable.strings is still left on the phone, hiding the new ./Swedish.lproj/Localizable.strings. The translations in ./Swedish.lproj/General.strings and ./Swedish.lproj/Settings.strings both works.
My fear is that if we release the update as is the users would be forced to uninstall the app before installing the update to get the translations to work, which would mean that they lose all their saved data. So you can see why this issue has high priority.
If I have understood the cause of the problem correctly, my question is how do I get rid of the ./Localizable.strings already present on the phone? The more general question would be how do I solve this problem?
Are you testing this in debug mode and Xcode is installing the new binary onto the device/simulator or are you doing an Adhoc build-and-archive and then test the update via itunes?
I know that xcode at times will not overwrite files when doing an build and run in debug mode. A touch of the file will not help, but only a clean-all, exit and restart of both Xcode and simulator cures it.
If you are using the adhoc build then the complete app bundle sould be overwritten. If this is not working something serious is at fault.

Check whether app updates work without submitting to App Store

I have an application already on the store and would like to release an update. Since my app deals with databases and I've had to change some parts of it, I would like to ensure that the update does not affect the existing functionality in any way once the user updates from the App Store.
What I did was this - install the first version of my app on my device. Changed the update's version in info.plist to 1.1 and run it via xcode (and install on my device). But what happens by doing this is some of the changes I made to the XIBs do not show up. It looks as if the app was only half-updated (if you know what I mean)
Is there any way to update an existing app programmatically without having to go through the app store and then find out it could lead to a disaster?!
Thanks for any help!
I would double check your build configuration. Between building the two versions of the app, I would recommend a "Clean All" just to be safe. The process you described works to verify updates. The only other alternative I can come up with is to create Ad-hoc distributions of both versions of your app, and install those.

How can simulate the IPhone app upgrade process in the SDK simulator

I'm working on an iPhone app and about to release version 2. We'll be changing the core data model and I'd like to simulate the upgrade process in the simulator before releasing it to users and potentially causing data loss for them. There doesn't seem to be any real good doucumentation on how to do this in a sandbox before releasing it.
The process I've used in the past has been to wipe any working version from the Simulator, check out the previous version of my application from my repository, compile and install that, work with it for a bit, then compile and install the new version of the application. The installation of the new version should simulate the upgrade process, where you can test your data migration to your new model.
I also repeat this process on the device to make sure no problems are encountered there either.
there are some cases that cannot be simulated in Xcode. Look at this Apple page: https://developer.apple.com/library/ios/technotes/tn2285/_index.html
You have to create IPA file and simulate update via iTunes.
I agree with Brad's overall approach. To save a little time, I would just save the sample set of data that you create with the older version of your app. This way you won't have to keep recreating the sample data set if things don't go right. You will just simply copy the sample data set back into your app's directory in the Simulator.
Your app's directory is located at ~/Library/Application Support/iPhone Simulator/User/Applications/A GUID for your App on your development machine.