my ios works on ios simulator, but crashes on the device
simulator
- read -> TextField1 shows data
2.update
- read -> TextField1 shows new data
iphone
- read -> TextField1 shows data
2.update CRASH
3. read -> TextField1 shows new data
read
[code]
Dim dbFile as FolderItem
dbFile=SpecialFolder.GetResource(“Main.db”)
If dbFile.Exists Then
App.db = new SQLiteDatabase
app.db.DatabaseFile = dbFile
If app.db.Connect Then
Dim rs as SQLiteRecordSet
rs = app.db.SQLSelect("SELECT * FROM whatever")
If rs <> Nil Then
TextField1.Text = rs.Field("name").TextValue
rs.Close
End If
end if
end if[/code]
update
[code]
If app.db <> nil Then
If app.db.Connect Then
Dim sql As Text
sql = "UPDATE whatever SET name = 'a' WHERE id = 1"
app.DB.SQLExecute(sql)
end if
end if[/code]
[quote] Dim dbFile as FolderItem
dbFile=SpecialFolder.GetResource("Main.db")
[/quote]
your db is in your bundle so read-only on device
what can I use to have read/write access?
here
Dim dbFile as FolderItem
dbFile=SpecialFolder.GetResource("Main.db")
and here
[code][Begin BuildStepList iOS
Begin BuildProjectStep Build
End
Begin SignProjectStep Sign
End
Begin CopyFilesBuildStep CopyFiles1
AppliesTo = 0
Destination = 1
Subdirectory =
FolderItem = Li4ATWFpbi5kYg==
End
End/code]
First of all the copy files step must be before the signProject step otherwise the bundle will have the wrong signature.
It’s ok to “save” the db in the bundle as long it will be readonly
if you need to modify it you can create a new db in your app documents folder, attach the original db, copy the data and detach the original
dear antonio
can you upload an project that can read and write from a sqlite database and
works on an ios device?
thanks a lot
andreas
See the Eddie’s Electronics iOS example. It shows how to do copy a DB to the bundle using a Copy File Step and then copy it out of the bundle to Documents using SpecialFolder and FolderItem.
Eddie’s Electronics iOS example crashes also!!! on a device, please try it on your iphone.
they use
dbFile = SpecialFolder.GetResource("EddiesElectronics.sqlite")
GetResource is the right way to get the file in the bundle so you can copy it to a writeable area.
The EE crash is caused by a corrupted auto-layout setting. This fix didn’t make it into b6, but it will be in the fc. You can temporarily work around that by removing the label on the About view.
Paul
you are wrong. EE works in b6:-) thxs