iOS Persistent store issue - ios

I am using core data with preloaded sqlite database. I am encountering a strange issue, the app works on the simulator, but when I try run it on a device, e.g. iPad, I get the error below.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSManagedObject persistentStore]: unrecognized selector sent to instance 0x3bebf50'
I recreated the sqlite database from the model and repopulated the database, but I still get the same error. I've checked the 'Compiled Sources' and 'Copy Bundle Resources' in the build phase section and the files are all there.
Code:
http://pastebin.com/fTTgEA3W
Been racking my brain and can't seem to understand why it's not working, any help would really be appreciate.
Thank you for your time and if you need any more information please let me know.

First measure: delete the app and reinstall.
Second measure: text search for a call to persistentStore in your code. It is apparently going to an address that is a NSManagedObjectContext which does not have this method. Fix the error if you find it.
Third measure: review your recreation algorithms to make sure you are building the store correctly. In my projects with big stores, I usually have a SETUP flag that I switch on if the store needs to be imported from raw data, which normally works only in the simulator because of the memory needs. (When SETUP is off and there is no store, the one generated previously is copied over.) Maybe on the iPad you do not have enough memory to do the data import.

Related

My CN1 app crash on startup

Since today I can't run a CN1 debug the app on my iPhone 4 (iOS 9.3.5). It crashes on startup.
I've made only minor changes:
Add a button which uses execute(URL) to open a URL.
and I've got this exception:
Library not loaded
/System/Library/Frameworks/UserNorifications.framework/UserNotifications
[...]
Reason: image not found.
Can you help me, please?
That's probably a regression due to changes that went in to implement https://github.com/codenameone/CodenameOne/issues/2208
It's probably due to this commit: https://github.com/codenameone/CodenameOne/commit/a3a70fadd7dbef661351d11dc35683be3d828eda
Can you please file an issue to keep track on this?
We're looking into it.

There doesn't seem to be a valid compiled storyboard while inserting records to sqlite database?

I am developing an app in which i am getting data from server & saving that data to local sqlite database.But data is too much there are records in hundreds which i am inserting.At one point in inserting records to database my app gets below error message & get crashed.Plaese tell why this issue coming?
2016-04-02 16:59:41.406 [2057:107245] -[UIApplication endIgnoringInteractionEvents] called without matching -beginIgnoringInteractionEvents. Ignoring.
2016-04-02 16:59:41.535 [2057:107245] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'There doesn't seem to be a valid compiled storyboard at path '/Users/apple/Library/Developer/CoreSimulator/Devices/927CC377-23D5-4648-8D78-05B117A19C5C/data/Containers/Bundle/Application/B1677AEC-3672-45EB-A80E-CAD2AEECB767/MyApp.app/Base.lproj/Main~iphone.storyboardc''
This error appears when the bundle target isn't universal. So make sure the Targeted Device Family in the bundle's build settings is set to iPhone AND iPad.

-[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class

I have an error I don't understand after I updated my app. I have an app already in the app store. I have some app specific data archived and stored in a file inside application support directory. I was reading and storing the data every time when the app is launched and sent to background. Everything was fine so far. Now I released an update to the app. After the update when I launch the app and try to unarchive the data it crashes with below exception.
-[NSKeyedUnarchiver decodeObjectForKey:]:
cannot decode object of class (ProjectName.ProjectFile) for key (root);
the class may be defined in source code or a library that is not linked.
If I delete the app and install the app again everything works fine.
Both my original app and update are written in Swift. I haven't changed the file name also from version 1 to 2. Does any one know what is happening ?
I found the reason for the above.
Basically I changed the project target name from version 1 to version 2. So it was trying to decode ProjectName2.ProjectFile instead of ProjectName.ProjectFile.
The possible way to avoid is #objc(PFUserUtils) for the class when you start the first version. If you change the target name like me, use NSKeyedUnarchiver.setClass(className forClassName:name) method to set the class name to old one.

Could not instantiate class named ADBannerView after Removing iAD

Weird thing that I have spent about 4 hours debugging:
Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named ADBannerView'
I used to have iAD and then removed it. Now I use Google AdMob.
I have macros set up to determine the free/paid version. On the free version that is supposed to show ads, everything is fine and it displays the AdMob ads.
In the paid version, which does not call any ads, I get this error: Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named ADBannerView'
The only thing I can think of is that I may have an old iAd Banner View somewhere, but I can't find it!
Any hints?
Also: Everything works fine on the simulator.
Have you checked to make sure that there are no ADBannerViews in Interface Builder? The sort of error you are seeing says that the app is trying to create one somewhere.
Educated guess:
are you using the UI State Preservation & Restoration API? If so return NO from application:shouldSaveApplicationState: to get rid of the current saved state.
Once that works you should implement some kind of restoration version checking to prevent crashes on your users devices.
If that doesn't work, or you are not using state restoration, try to delete the app from the device. If you deploy from Xcode files are only added, never removed. So it's possible that an old file references ADBannerView. Delete the app to get rid of such orphan files.
Edit: That link should take you to the "Encode version information along with the rest of your app’s state." section. It doesn't, but you will find a small info about version checking at the bottom of the page.

iOS simulator crashes when using Google Maps SDK for iOS

This is driving me crazy...
I have been using Google Maps SDK for iOS for a while (even in an App Store product).
Now, I cannot make it run in the iOS simulator any longer! It doesn't matter which project I try to run (even the sample code from the SDK), it will always crash the first time a map is added, e.g.:
self.view = [GMSMapView mapWithFrame: frame camera: camera];
This is the log messages I get:
2013-05-16 10:59:01.047 SDKDemos[939:1303] ADDRESPONSE - ADDING TO MEMORY ONLY: http://dl.google.com/geosdk/latest
2013-05-16 10:59:01.050 SDKDemos[939:1b03] Google Maps SDK for iOS version: 1.2.2.3031
2013-05-16 10:59:01.050 SDKDemos[939:1b03] New version of Google Maps SDK for iOS available: 1.3.0.3430
2013-05-16 10:59:01.111 SDKDemos[939:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
I have lately tried an antivirus SW on this mac, so one theory is that it may have blocked some vital Google Maps data from downloading. Now, I have uninstalled this anti-virus SW, removed Xcode's DerivedData and reset the iOS Simulator, but with the same disappointing result.
All projects I have tried are working perfectly fine when I run them on my iPhone. I have also another mac where everything works fine on the simulator. So clearly something must have happened with this particular machine.
Any advice?
Update
Initially, I focused entirely on the first warning message (ADDRESPONSE - ADDING TO MEMORY ONLY: http://dl.google.com/geosdk/latest), but I have now realised that the only purpose of the URL mentioned there is to download a string with the latest SDK version number (currently "1.3.0.3430"). Since the SDK then correctly prints that string two lines further down, I find it very unlikely that this line is related to the real cause of the crash. (I have changed the title of this question accordingly.)
Hard to say if this really qualifies as an answer...
In any case, I'd like to document the outcome of this, in case someone else stumbles upon the same problem in the future:
After having been away a couple of days, I returned today, turned on my iMac, made a new test run, and...
The problem was gone!
Everything just worked as expected!
I have not changed a single line of code or anything at all in the Xcode configuration.
The only thing I did was to once again delete Xcode's DerivedData and reset the simulator (which I did numerous times last week, but without success at that time).
I guess that my assumption must have been right, that there must have been a cache somewhere in my machine, but outside Xcode´s DerivedData, that caused this problem. Then I was away a couple of days, and this cache simply timed out!
Even if this may sound a bit far-fetched, I cannot think of another reason for this weird behaviour.
It would have been really useful to know where this cache is located, so that one could clean it up without needing to shut down the mac for some days!

Resources