SQL error on iOS5 but not iOS4 - iphone

I am using sqlite in an app for iOS, and it was working perfectly fine to retrieve objects from the data base on iOS4. But on iOS5, when I execute a statement (using the function sqlite3_step), it sometimes returns a SQLITE_CORRUPT error (meaning that "The database disk image is malformed").
The request fails upon this error. When using a third party app to inspect this database I also stumble on this error.
My question is: why has changed between iOS4 and 5 to stop the request to work just fine? Is there a way to configure sqlite on iOS to ignore this kind of error?
I precise that I'm using the very same code and database on the 2 version of the OS....

Related

Firebase Connection Killed

I have integrated Firebase into my iOS project. I have been using Firebase for years across many projects. This specifically is using the Firestore. I can authenticate fine and write to the database. However, after the write is complete, even though it's successful, I receive the following message:
Firebase Database connection was forcefully killed by the server. Will not attempt reconnect. Reason: Firebase error. Please ensure that you spelled the name of your Firebase correctly
The bundleID was copied and pasted directly from the app to the Firebase setup. I even deleted the app from Firebase and created it again. I have downloaded the GoogleService-Info.plist and I checked that the bundle there matches the bundle of the app. I can see nothing wrong here and again functionality is working fine.
The only instance I saw of this message browsing around was with a non-US based developer and it was suggested that additional config was required. However, that is not the situation for me. What else might cause this error to be generated?
The error message seems to point towards Realtime Database, despite your interest in Cloud Firestore.
I recommend:
Making sure you're using the latest SDK. Old SDK versions (before mid 2020) might require the Realtime Database URL to be present in the plist file, which isn't always the case anymore.
If step 1 doesn't solve the problem, you can:
Force the creation of a Realtime Database instance in the Firebase console.
Download the updated plist file and add it to your project.
If you end up with the second solution, can you comment with the SDK version you're using, so that I can check for issues in that?

server did not accept client registration 68

I have an app currently deployed on the app store. Just a few days ago, it stopped working all of a sudden. I am receiving the following error within xcode when testing my application.
server did not accept client registration 68
I am using xcode 4.1. I have read about this error online and seen the workarounds. My issue is that my application was running fine. No issues whatsoever. It literally just ceased to load data all of a sudden a few days ago. No updates were pushed, no code was modified. How is it possible for it to jus stop working all of a sudden? Could it be an update with Apple?
There is not enough info to go on in your question, but by doing a search on the error message, it might be related to CoreLocation.
Has your App for whatever reason be set to not use location services (within the Settings app), real device or simulator? If so, see this SO on how to handle it nicely in code using didFailWithError

sqlite3 fails to read database for me, but not for same commit on another machine

BACKGROUND
We have an iPhone app that uses sqlite for a large database. We use FTS3, full text search, so we have to "roll our own" sqlite instead of using the library included in the iOS SDK. We use the amalgamated sqlite.c file, and we use FMDB as an Obj-C wrapper.
THE PROBLEM
My project compiles, but it crashes on an exception that I've installed to detect if the database is malfunctioning (more on that in a bit). My partner, however, is merrily coding away, with no problems - on the EXACT SAME commit revision as me. That's what's weird.
Specifically, the app does the following on first load:
Copy the database into the user's document directory so that it is writeable. (working OK)
Open the database using FMDB's databaseWithPath: followed by open.
Calling goodConnection on FMDB at this point returns YES - the database is indeed open and working.
Calling SELECT * FROM sqlite_master WHERE type = 'table' returns no records. (there should be many tables)
WHAT I'VE TRIED
Now, if you ask sqlite to "open" a database that doesn't exist -- it'll just create one. That's what this behavior looks like. So, I opened up a Terminal window, navigated to my app's Documents directory on the simulator, and typed:
Makbook:Documents makdad$ sqlite3 myDB.db
Which runs sqlite3, and, of course, everything looks fine. All my data is there.
I stepped through line-by-line of FMDB's open method to make sure I was opening the right database. It looks like I certainly am.
First thing I tried was downgrading to Xcode 3.2.6. Same problem, so I think I've ruled out an Xcode 3/4 difference in compiling (although I suspected that at first).
Does anyone have any debugging-fu to try, or any knowledge as to what my problem could be?
Had the same issue with our custom compiled SQLite3. I found a solution to this problem on this blog http://regularrateandrhythm.com/regular-rate-rhythm-blog/sqlite3-fts-in-IOS4.html
The problem is with the iOS 4.3 SDK Simulator. I had neglected to test the iOS device itself, and it works.
To support older iOS versions, we use the -weak_library /usr/lib/libSystem.B.dylib linker flag. Removing that flag on iOS Simulator 4.3 stops ALL the weird behavior relating to sqlite3.
The reason my partners weren't having the problem is that they are running Xcode 3.2.5, which is 4.2. Even when I downgraded to Xcode 3, I still had 4 installed - so 3 was using the 4.3 SDK as well.
I am going to open a new question about the new issue, as this question is so far off the actual issue :)

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?

Connecting CoreData to my App on an iPhone Device

I apologize ahead of time for what I'm sure is a complete newbie lapse. Running my iPhone app on iPhone simulator - no problem. But I loaded the app on an iPhone device for the first time and it appears as if the SQLite database I'm using (NSManagedObjectContext) isn't connected or didn't upload. The app installs but with no data. How do I get it all to upload and work on the device?
I appreciate any help.
lq
The first rule with Core Data is that you should never ever touch the store directly. It should be considered a black box and only accessed via the the Core Data APIs. Accessing the database directly is unsupported and can lead to data corruption.
What you should do instead is create a trivial desktop application (or command line is you are just importing from another source) and enter the data there. Once the data is entered then copy the sqlite file to your mobile application and include it in the bundle. That way you are accessing the file from Core Data. Since Apple can and does change the structure of that file without notice your application will be future proof.
update
If you have created a database using Core Data you can then take that sqlite file and add it to your Xcode project for your iPhone application. Xcode will then copy it into the app bundle when it compiles the project.
Looking a little deeper I found a link that answers my own question. So anyone with the same question, this solved the issue for me:
http://ablogontech.wordpress.com/2009/07/13/using-a-pre-populated-sqlite-database-with-core-data-on-iphone-os-3-0/