generating device database (error of no generate) (permissions?) help!

Hi!

I wonder how I can get permission to iOS (device) to let me create my database to the decision:

[lua]

–Open data.db. If the file doesn’t exist it will be created
local path = system.pathForFile(“dataa2.db”, system.DocumentsDirectory)
db = sqlite3.open( path )

–Handle the applicationExit event to close the db
local function onSystemEvent( event )
if( event.type == “applicationExit” ) then
db:close()
end
end

local tablesetup = [[CREATE TABLE IF NOT EXISTS nivel2 (id INTEGER PRIMARY KEY, valorN2);]]
print(tablesetup)
db:exec( tablesetup )

[/lua]
In the simulator works perfectly but my iphone does not generate any database.
permissions problem may be?

Thanks! [import]uid: 192093 topic_id: 36229 reply_id: 336229[/import]

anyone know? [import]uid: 192093 topic_id: 36229 reply_id: 143905[/import]

Are you getting an error?
[import]uid: 199310 topic_id: 36229 reply_id: 143909[/import]

Hi rob,

Sorry, this is the code. Is a test.
[lua]
require “sqlite3”

–Open data.db. If the file doesn’t exist it will be created
local path = system.pathForFile(“datos.db”, system.DocumentsDirectory)
db = sqlite3.open( path )

–Handle the applicationExit event to close the db
local function onSystemEvent( event )
if( event.type == “applicationExit” ) then
db:close()
end
end
local tablesetup = [[CREATE TABLE IF NOT EXISTS nivel (id INTEGER PRIMARY KEY, valor);]]
print(tablesetup)
db:exec( tablesetup )

valor = 1
tablesetup =[[INSERT INTO nivel VALUES (NULL, ‘]]…valor…[[’);]]
db:exec( tablesetup )
for row in db:nrows(“SELECT valor FROM nivel”) do

if row.valor == “1” then
print(“show image if dattabase is true”)
a2 = display.newImage(“a2.png”)
a2.x = 120
a2.y = 267

else
print(“no image”)

end
end

[/lua]

It must be the database because the simulator executes the code correctly, however, the device does not show the image I want to show. So “intuit” the error comes from there
[import]uid: 192093 topic_id: 36229 reply_id: 143922[/import]

Are you getting any errors in your console log?

[import]uid: 199310 topic_id: 36229 reply_id: 143925[/import]

in the simulator console gives no errors [import]uid: 192093 topic_id: 36229 reply_id: 143926[/import]

anyone know? [import]uid: 192093 topic_id: 36229 reply_id: 143905[/import]

Are you getting an error?
[import]uid: 199310 topic_id: 36229 reply_id: 143909[/import]

Hi rob,

Sorry, this is the code. Is a test.
[lua]
require “sqlite3”

–Open data.db. If the file doesn’t exist it will be created
local path = system.pathForFile(“datos.db”, system.DocumentsDirectory)
db = sqlite3.open( path )

–Handle the applicationExit event to close the db
local function onSystemEvent( event )
if( event.type == “applicationExit” ) then
db:close()
end
end
local tablesetup = [[CREATE TABLE IF NOT EXISTS nivel (id INTEGER PRIMARY KEY, valor);]]
print(tablesetup)
db:exec( tablesetup )

valor = 1
tablesetup =[[INSERT INTO nivel VALUES (NULL, ‘]]…valor…[[’);]]
db:exec( tablesetup )
for row in db:nrows(“SELECT valor FROM nivel”) do

if row.valor == “1” then
print(“show image if dattabase is true”)
a2 = display.newImage(“a2.png”)
a2.x = 120
a2.y = 267

else
print(“no image”)

end
end

[/lua]

It must be the database because the simulator executes the code correctly, however, the device does not show the image I want to show. So “intuit” the error comes from there
[import]uid: 192093 topic_id: 36229 reply_id: 143922[/import]

Are you getting any errors in your console log?

[import]uid: 199310 topic_id: 36229 reply_id: 143925[/import]

in the simulator console gives no errors [import]uid: 192093 topic_id: 36229 reply_id: 143926[/import]

anyone know? [import]uid: 192093 topic_id: 36229 reply_id: 143905[/import]

Are you getting an error?
[import]uid: 199310 topic_id: 36229 reply_id: 143909[/import]

Hi rob,

Sorry, this is the code. Is a test.
[lua]
require “sqlite3”

–Open data.db. If the file doesn’t exist it will be created
local path = system.pathForFile(“datos.db”, system.DocumentsDirectory)
db = sqlite3.open( path )

–Handle the applicationExit event to close the db
local function onSystemEvent( event )
if( event.type == “applicationExit” ) then
db:close()
end
end
local tablesetup = [[CREATE TABLE IF NOT EXISTS nivel (id INTEGER PRIMARY KEY, valor);]]
print(tablesetup)
db:exec( tablesetup )

valor = 1
tablesetup =[[INSERT INTO nivel VALUES (NULL, ‘]]…valor…[[’);]]
db:exec( tablesetup )
for row in db:nrows(“SELECT valor FROM nivel”) do

if row.valor == “1” then
print(“show image if dattabase is true”)
a2 = display.newImage(“a2.png”)
a2.x = 120
a2.y = 267

else
print(“no image”)

end
end

[/lua]

It must be the database because the simulator executes the code correctly, however, the device does not show the image I want to show. So “intuit” the error comes from there
[import]uid: 192093 topic_id: 36229 reply_id: 143922[/import]

Are you getting any errors in your console log?

[import]uid: 199310 topic_id: 36229 reply_id: 143925[/import]

in the simulator console gives no errors [import]uid: 192093 topic_id: 36229 reply_id: 143926[/import]

anyone know? [import]uid: 192093 topic_id: 36229 reply_id: 143905[/import]

Are you getting an error?
[import]uid: 199310 topic_id: 36229 reply_id: 143909[/import]

Hi rob,

Sorry, this is the code. Is a test.
[lua]
require “sqlite3”

–Open data.db. If the file doesn’t exist it will be created
local path = system.pathForFile(“datos.db”, system.DocumentsDirectory)
db = sqlite3.open( path )

–Handle the applicationExit event to close the db
local function onSystemEvent( event )
if( event.type == “applicationExit” ) then
db:close()
end
end
local tablesetup = [[CREATE TABLE IF NOT EXISTS nivel (id INTEGER PRIMARY KEY, valor);]]
print(tablesetup)
db:exec( tablesetup )

valor = 1
tablesetup =[[INSERT INTO nivel VALUES (NULL, ‘]]…valor…[[’);]]
db:exec( tablesetup )
for row in db:nrows(“SELECT valor FROM nivel”) do

if row.valor == “1” then
print(“show image if dattabase is true”)
a2 = display.newImage(“a2.png”)
a2.x = 120
a2.y = 267

else
print(“no image”)

end
end

[/lua]

It must be the database because the simulator executes the code correctly, however, the device does not show the image I want to show. So “intuit” the error comes from there
[import]uid: 192093 topic_id: 36229 reply_id: 143922[/import]

Are you getting any errors in your console log?

[import]uid: 199310 topic_id: 36229 reply_id: 143925[/import]