Test the app in my Ipad

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Test the app in my Ipad

Post by aebki » Thu Jan 08, 2015 9:41 pm

Hi,

Thanks for the 'quit'...:-)
Yes, in mobile sometimes the things are different!!! :-)


I think i made something wrong because changing this part of my code in this card, is not working the rest of my code ( for example when i am making one "SELECT" in another card before to show some data )

Now i will show you how is my code in the script once i changed what you told me:


local sDatabaseID
local tDatabasePath, tDatabaseID
global ruta
on preOpenStack

if the environment is "mobile" then
put "landscape left,landscape right" into theallowed
iphoneSetAllowedOrientations theallowed
end if

end preOpenStack

On OpenCard

put specialfolderpath("documents") & "/GestComp.sqlite" into ruta
 
  ## Path to db file in engine folder:
  put specialfolderpath("engine") & "/GestComp.sqlite" into tEngineDB
 
  ## Check if we already copied the db file to users doc folder:
  if there is NOT a file mypath then
    put url("binfile:" & tEngineDB) into url("binfile:" & ruta)
  end if

set enabled the button "btnConfig" to false
put CmpExist("VGestComp") into numb

if numb = 0 then
set enabled the button "btnConfig" to true
end if
end OpenCard

function CmpExist theData

databaseConnect
put getDatabaseID() into tDatabaseID
put revDataFromQuery(tab,return,tDatabaseID,"SELECT " & theData & " FROM VGest_Comp ") into theResult
return theResult

end CmpExist

command databaseConnect

put revOpenDatabase ("sqlite",ruta,,,,) into tDatabaseID
setDatabaseID tDatabaseID

end databaseConnect

command setDatabaseID pDatabaseID
put pDatabaseID into sDatabaseID
end setDatabaseID

function getDatabaseID
return sDatabaseID
end getDatabaseID



Is it ok? Or there is something wrong???

Regards

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Test the app in my Ipad

Post by aebki » Thu Jan 08, 2015 9:46 pm

In fact i just see one error in my i let in my last post, but once i corrected it is not making work the app...:-(

in the OpenCard i had this line:

"if there is NOT a file mypath then" and it should be like this:
"if there is NOT a file ruta then"

Regards

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Test the app in my Ipad

Post by Klaus » Thu Jan 08, 2015 11:31 pm

Please explain "not working" :D

Add some ANSWER dialogs so we can get a hint where it goes wrong!
and please use the CODE tags after pasting your scripts here.

Like this:

Code: Select all

## Not neccessary:
##local sDatabaseID

## We do not need tDatabasepath in this script, we use RUTA! :-)
## local tDatabasePath

## We only need:
local tDatabaseID
global ruta

on preOpenStack
   if the environment is "mobile" then
      put "landscape left,landscape right" into theallowed
      iphoneSetAllowedOrientations theallowed
   end if
end preOpenStack

On OpenCard
   put specialfolderpath("documents") & "/GestComp.sqlite" into ruta
   
   ## Just to be sure! Shoulod be true!
   ANSWER (there is a file tEngineDB)
     
     ## Path to db file in engine folder:
     put specialfolderpath("engine") & "/GestComp.sqlite" into tEngineDB
     
     ## Check if we already copied the db file to users doc folder:
     if there is NOT a file mypath then
          put url("binfile:" & tEngineDB) into url("binfile:" & ruta)
     end if
   
   set enabled the button "btnConfig" to false
   put CmpExist("VGestComp") into numb
   
   ## No idea what this should be :-)
   ANSWER numb
   
   if numb = 0 then
      set enabled the button "btnConfig" to true
   end if
end OpenCard

function CmpExist theData
   databaseConnect
   ##put getDatabaseID() into tDatabaseID
   put revDataFromQuery(tab,return,tDatabaseID,"SELECT " & theData & " FROM VGest_Comp ") into theResult
   return theResult
end CmpExist

command databaseConnect
   put revOpenDatabase ("sqlite",ruta,,,,) into tDatabaseID
   ## Should be a NUMBER on success or any hints on what wnet wrong 
   ANSWER THE RESULT
   
   ## Since you already declared tDataBaseID local, we can use it in any handler here!
   ##setDatabaseID tDatabaseID
   
end databaseConnect

## Unneccessary overhead, see above :-)
#command setDatabaseID pDatabaseID
#   put pDatabaseID into sDatabaseID
#end setDatabaseID

#function getDatabaseID
#   return sDatabaseID
#end getDatabaseID
Best

Klaus

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Test the app in my Ipad

Post by aebki » Fri Jan 09, 2015 11:23 am

Hi Klaus,

I have the next results:

for the "ANSWER (there is a file tEngineDB)" i have one "FALSE"

for the "ANSWER numb" i have one "1" ( if the answer is 0 i should configure some tables, and if it is 1 it means that they are already configured )

for the "ANSWER THE RESULT" i have one error that i attached as an image.

The error i have is about the table "VGest_Comp" as is not existing...And i am wondering if the problem is in the step i should copy my database (in "my path/Documents/GestComp.sqlite" ) to the special folder path "engine"

The other day i attached one image showing that in my standalone settings i had in the 'copy files' two lines: one was "/documents/Gestcomp.sqlite" and the other was "/documents/*"...These lines should continue like this.

So i was wondering about this, because in 'local' this table is existing but once we are moving it to the special folder "engine" i have this error.

I don't know if i expressed myself well...:-)

Regards
Attachments
errorDB.png
errorDB.png (25.73 KiB) Viewed 8078 times

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Test the app in my Ipad

Post by aebki » Fri Jan 09, 2015 6:05 pm

Hi,

I can't see where is the problem with the database...
I am still blocked here...:-(
The only difference i have in the code, is the fact to move the database to the special folder...But since this moment i am not able to interact with the database...Even to make one "Select" in the function "CmpExist" in the "OpenCard", as it can't find the table...:-(

What is wrong in this code???

Regads

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: Test the app in my Ipad

Post by dave.kilroy » Fri Jan 09, 2015 7:03 pm

hi aebki

I'm wondering if you are experiencing a version of the bug I reported on christmas eve (http://quality.runrev.com/show_bug.cgi?id=14295) - I thought it only affected builds for Yosemite but maybe it messes up builds for iOS too

Could you use something like 'PhoneView' to check whether there is or is not a file at your tEngineDB location (sounds like there isn't and livecode is creating and opening an empty database)

Dave
"...this is not the code you are looking for..."

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Test the app in my Ipad

Post by aebki » Fri Jan 09, 2015 10:58 pm

Hi Dave,

Thanks for your answer...:-)

I read what you reported in the link...

I looked on internet and if i understood well 'PhoneView' is working for Iphone and Ipod...:-(

Anyway, in case there is one tool to confirm this, then what should i do? There is solution for this?
So, what i have to do?

Regards

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Test the app in my Ipad

Post by maxs » Sat Jan 10, 2015 3:59 am

I set up my new ipad on the IOS dev site with the list of dev devices. I put in the Ipad name and the ID code. BUt when I try to drag my app into xcode, I get a message that the machine has no provisioning certificate.

Is there another step I need to get my ipad to accept dev apps?

Max

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: Test the app in my Ipad

Post by dave.kilroy » Sat Jan 10, 2015 12:42 pm

hi aebki - Just to be clear, I have no connection with phoneView, I'm just a customer. If you go to their website (http://www.ecamm.com/mac/phoneview/) they have a 'try it for free' option

I've been using phoneView in development for several years to confirm existence of files and check correct population of files on iOS devices - and I was suggesting you confirm the existence of your database in the engine folder as part of your debugging efforts. If you want to use phoneView install it on your mac and when your iOS device is connected by cable you should find that phoneView will be be able to let you look into the 'engine' and 'documents' folders in the sandboxed area where your app is installed (which is sometimes very useful)

Good luck!
"...this is not the code you are looking for..."

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: Test the app in my Ipad

Post by dave.kilroy » Sat Jan 10, 2015 12:50 pm

hi maxs - you don't mention a provisioning profile in your post. Did you create a provisioning profile on the development portal? Download it to your mac? Once downloaded did you double-click it to get it into Keychain/Xcode? Did you go into Preferences in Xcode and then Accounts to confirm all your certificates, ids and profiles? And finally did you rebuild your app making sure that the provisioning profile was properly selected?

Good luck!

Dave
"...this is not the code you are looking for..."

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Test the app in my Ipad

Post by aebki » Sat Jan 10, 2015 3:22 pm

Hi Dave,

Thanks for the answer...:-)

I downloaded phone view and i tried it...

I will attach two images.

In one of them the database has 70 KB and in the other 0 bytes...And they are located in two places.
Maybe is for this that i have the problem? That is going to the empty one?

Maybe i made something wrong with the code Klaus corrected me???

Regards
Attachments
phoneview2.png
phoneview1.png

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Test the app in my Ipad

Post by maxs » Sat Jan 10, 2015 9:07 pm

For the icon, a workaround is to select the app and do "Commandkey" and "1" for "get Info'

Then you can manually paste a clipboard image into the top left icon rectangle . Then the icon image will appear on the desktop.

I hope this helps a little. Max

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: Test the app in my Ipad

Post by dave.kilroy » Sat Jan 10, 2015 9:26 pm

hi aebki

In your code:

Code: Select all

  put specialfolderpath("engine") & "/GestComp.sqlite" into tEngineDB
You are trying to find the database in the 'engine' folder, but in your screenshot you seem to have your database in a 'documents' folder that is inside the 'engine' folder.

This will mean that the copy of the database will fail and that LiveCode will go on attempt to open a database which is not there, because it can't find it, it instead creates a new empty database, and that is why you get the message that it can't find the database table. So don't put your database inside a 'documents' folder and with any luck your problem will be solved :)

Kind regards

Dave
"...this is not the code you are looking for..."

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Test the app in my Ipad

Post by Simon » Sun Jan 11, 2015 12:22 am

Hi aebki,
Just in case you didn't know.
All apps automatically have a "documents" folder, check out specialFolderPath in the dictionary.
What that means is you don't have to create one just copy your db from the "engine" folder to "documents" folder.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Test the app in my Ipad

Post by aebki » Sun Jan 11, 2015 12:19 pm

Hi,

Thanks for your answers...:-)
I put my database outside of the folder and i erased the folder!

Finally it worked...Even if i had to change my code too...:-)

This is what i had before:

Code: Select all

put specialfolderpath("documents") & "/GestComp.sqlite" into ruta
   
   ## Just to be sure! Shoulod be true!
   ANSWER (there is a file tEngineDB)
     
     ## Path to db file in engine folder:
     put specialfolderpath("engine") & "/GestComp.sqlite" into tEngineDB
     
     ## Check if we already copied the db file to users doc folder:
     if there is NOT a file ruta then
          put url("binfile:" & tEngineDB) into url("binfile:" & ruta)
     end if
And this is what i have now:

Code: Select all

put the effective filename of this stack into ruta

set itemdel to "/"
## remove filename of runtime/stack:
delete item -1 of ruta
put "/GestComp.sqlite" AFTER ruta

   ## Just to be sure! Shoulod be true!
   ANSWER (there is a file tEngineDB)
     
     ## Path to db file in engine folder:
     put specialfolderpath("engine") & "/GestComp.sqlite" into tEngineDB
     
     ## Check if we already copied the db file to users doc folder:
     if there is NOT a file ruta then
          put url("binfile:" & tEngineDB) into url("binfile:" & ruta)
     end if


I will continue testing if everything is ok...

Regards

Post Reply