Runtime EXception on re-compile the code in Blackberry - blackberry

I've created app.It working fine.
When i've changed some code and compile, it throws "Runtime EXception."
After i've deleted *.dmp file. Its working fine.
Everytime i compile it throw the exception. i delete *.dmp file and re execute.
Pls help me what is the problem and how to avoid it.

On my experience this error is connected to changes in data structures you save/load from/to PersistentStore.
If you have stored object with a particular structure, and after that you change your object structure, you will get exception upon loading this object from the persistent store.
Removing dmp files cleans your simulator persistent store and your app works fine.
But with old, non-compatible objects stored in dmp file (simulator persistent store) you get the exception.

Related

Replace core data model in new version of app without having previous source code

Hi I struck at core data migration issue. I have developed a app which is new version of an existing app in Appstore. But i don't have source code of previous version and don't know exactly that whether core data was used in old version or not. So how to update my app (which has core data) to Appstore without any crashes. Any quick solution please?
Since you mention in a comment that you want to ignore the old data, you don't need to do any kind of migration. Model migration is about updating existing data to work with a newer data model. The only danger would be if the old app used Core Data and your new app attempts to use a persistent store file with the same file name. Then your app would attempt to load the old data, since it would find that file with the correct name.
The easiest way to test this is:
Install the existing app (from the app store)
Use this app until you're sure it's saving some data
Install the new version from Xcode. Since it's an upgrade, it will overwrite the app store copy.
By then you'll know exactly what happens when upgrading. If you get a Core Data related crash, change your Core Data setup to use a different filename. Then delete the app from your iOS device and repeat the test from above.

The model used to open the store is incompatible with the one used to create the store Xcode 7.1

I created a core data model that was working fine until I added a new entity to the model, my code is fine I think... because Xcode can't detect any errors, but as soon as I run my app on the simulator the compiler gives me an error saying
reason=The model used to open the store is incompatible with the one used to create the store
I don't quite understand what this error means. I did search for references regarding this error but the one I found is outdated it was from Xcode 3.2, I'm currently running Xcode 7.1.1, interestingly enough there's no check mark on none of the replies. Despite that I still tried to use some of those methods and nothing has worked.
Things I tried
Resetting iOS Simulator -> Reset Contents and Settings...
Deleted the [Simulator App Folder]/Document/*.sqlite and ran the project
Have you had the same problem? If so can you help me troubleshoot it? Thanks.
That error means that you changed the model so that it doesn't match the one you were using when you created the app's data. It's the classic sign of changing a data model and not either doing model migration or deleting the app from the phone/simulator (and it's been pretty much the same as long as Core Data has existed, so old information is not irrelevant). Deleting the app from the simulator would normally be all that's needed to run the app again. If it's not working, then you're somehow leaving old data in place.
The best way to delete an app from the simulator is usually the same as you'd delete an app on a real device-- click and hold until the app icon starts moving, then click the "x" on its icon to delete it.
If deleting the app doesn't help, you're using old data some other way. Maybe you have some pre-loaded data built into the app that was configured using an old version of the model?
My favorite solution is to open the sqlite database with a third party app, then open the Z_MetaData table and delete the row found in there.
Works like a charm every time.
It may affect your 'migration' if you do migrations.
We do not, so not an issue.

xcode project export error

I have this problem: I sent to a friend my xcode project, he is able to open and run without errors, but at some point the app crashes.
More precisely app manages a sqlite database that stores the scores of the game and just when he tries to enter the page that shows the scores the app crashes with a NSRangeException as the data structure that stores the scores extracted from the db is empty.
Of course in my Xcode it works perfectly so, is there anything special I need to do before exporting a project to make it work on another mac? Should I also add the db file and make him re-import into his project?
I just created a zip file with the project folder.
If anyone can help me would be greatly appreciated. Thank you

Files getting deleted mysteriously from the Documents Folder

We have an iOS application for the iPad that is having strange behavior. We store the state of the app in an XML file in the documents folder. Every once in a while our testers are reporting that when the application crashes the file on the disk gets deleted as well. This is very strange, since I can't figure out what can be causing this. Any pointers to how I can debug this issue.
The problem is complicated by the fact that this happens randomly and only on certain ipads(generally iPad2). We are using NSData initWithcontentOfFile.
By any chance can this be related to memory mapping of the files.
Make sure you are writing atomically

Core Data migration failing on Release builds only

I added an attribute to a Core Data model (iOS). I was on version 2, so I added a new model and saved the new attribute under version 3.
My loading code is standard (initializing a MOM using initWithContentsOfURL: pointing at my .momd directory inside my bundle), then passing that MOM to a NSPersistentStoreCoordinator.
Then, I download my app from the App Store, run it, and then try to test the migration. Lightweight migration is working fine on my Simulator and my phone in Debug (tethered to Xcode 4).
However, when I sync a Release build (using the "Archive" feature on Xcode) using iTunes, my app's data store fails to migrate with this error:
Error Domain=NSCocoaErrorDomain Code=134130 "The operation couldn’t be completed.
(Cocoa error 134130.)", reason=Can't find model for source store}
Worse yet, the store gets lost in some voodoo state where it cannot escape - if I re-tether the device and install a Debug build from Xcode again, I can't "recover" the migration.
The error message above omits the details about my entities. I can provide that if helpful, but any ideas on what might be wrong here? I've read just about every question on SO about this error code and so far all of them have failed to produce a result.
I tried a manual migration, but it also yielded an error. However, since I only added 1 attribute to 1 entity, it doesn't make sense that lightweight migration isn't working.
Every time I've seen this problem, in my code or someone else, it has been XCode getting into some kind of bad state with regards to the model versions it deploys in the application. Open the Release IPA archive of your app, and look at what mom files are in it. If you see one of the previous versions missing, that is likely this same problem. As for a solution, I've had mixed results; some variation of the following steps works for me, but never in a consistent order.
Clean & delete the derived data for the project (make sure you have an archive of your released app saved so you can symbolicate if necessary)
Rename the previous model version files (in xcode), adding or removing the space between the name and the digit representing the version number (if it has a space, replace with '_', if it doesn't have a space try adding one)
Add a new version of the model, without changing any of it's content, and make it the 'current' version
I know these steps seem like grasping at straws, which is exactly what it feels like whenever this happens to me. You might consider using one of your support incidents with Apple, it would be nice to know what their official answer to this issue is.

Resources