how to troubleshoot in iOS simulator?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
how to troubleshoot in iOS simulator?
Hello, I'm not sure if this the correct place to post this, but I am just getting started with LiveCode and have been following along with the webinars. In the recent Week5 Coursework, the LiveCode sample of the Ticked Off includes the resizing for the phone, so I tried it in the iPhone simulator. What I found was, while it ran and went to the various cards, I couldn't get it to create a new task. I eventually figured out what was wrong, but during the process I realized that I didn't have a good way of troubleshooting something like this.
Are any methods you could suggest, or any documents about it?
Thanks! BTW, Really enjoying the class, and looking forward to the weeks to come,
Diane
Are any methods you could suggest, or any documents about it?
Thanks! BTW, Really enjoying the class, and looking forward to the weeks to come,
Diane
-
- VIP Livecode Opensource Backer
- Posts: 7239
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: how to troubleshoot in iOS simulator?
The release notes mention that debugging is very rudimentary in iOS, but you can do a little from the simulator. Basically you use "put" to output any data you need to know about (usually the value of variables, but it can be anything.) When you "put" data without a destination, it goes to stdout, which the Console app picks up and logs. Then you can look in Console to see what got "put" there.
For example, in your standalone:
get the date
put it
In Console, you should see an output line containing the name of the simulator, followed by the current date.
For example, in your standalone:
get the date
put it
In Console, you should see an output line containing the name of the simulator, followed by the current date.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: how to troubleshoot in iOS simulator?
Hello Jacque, Thanks for your reply. I tried it in a test app, and couldn't get it to display in the console. Are you putting the lines in a stack script? And is it just by itself (not a function)? If I can't get it to work, it's not a problem, I'll plan a workaround by creating a diagnostics card in my stack. -- Diane
-
- VIP Livecode Opensource Backer
- Posts: 7239
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: how to troubleshoot in iOS simulator?
It doesn't matter where the line of code is, it can be in any handler anywhere. If there is no specific destination for the "put" command, it goes to different places depending on the environment. In the IDE, a "put" with no destination goes into the message box. In the iOS simulator, it goes to Console. You can scatter "puts" all over the place if you want, anywhere where you need to know some info about what's going on.
Open the Console app while you are testing in the simulator. Select the 2nd line in the logs list at the left, the one called "Console Messages". That opens a dynamic log on the right side of the window where your "put" commands will appear. (Other app messages will appear there too.) Then run any scripts in the simulator, or click any buttons, or do whatever else has handlers where you've placed a "put" command with no destination.
Say you have a button with this script:
on mouseUp
put the date into field "myDate"
put the result -- this put has no destination, it isn't put "into" anything
end mouseUp
That will work fine as long as you have a field named "MyDate" and the result will be empty. In Console, you'll see a line tagged with the simulator name but nothing else. But if you do not have a field named "myDate" then there will be an error, something like "No such object", which will go into the result. In that case, "put"ting the result should show a line in Console that says "no such object".
Open the Console app while you are testing in the simulator. Select the 2nd line in the logs list at the left, the one called "Console Messages". That opens a dynamic log on the right side of the window where your "put" commands will appear. (Other app messages will appear there too.) Then run any scripts in the simulator, or click any buttons, or do whatever else has handlers where you've placed a "put" command with no destination.
Say you have a button with this script:
on mouseUp
put the date into field "myDate"
put the result -- this put has no destination, it isn't put "into" anything
end mouseUp
That will work fine as long as you have a field named "MyDate" and the result will be empty. In Console, you'll see a line tagged with the simulator name but nothing else. But if you do not have a field named "myDate" then there will be an error, something like "No such object", which will go into the result. In that case, "put"ting the result should show a line in Console that says "no such object".
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: how to troubleshoot in iOS simulator?
Hi Jacque, Thanks for your reply. I tried it, but don't get any outputs for the "put" to my Console log. I'm not sure if it's in my setup, because I am getting error messages, which I get every time I run the Console app, whether it's a LiveCode app or an Xcode one. But when I run it in Xcode & write to the console (NSLog), I do see my Console messages appearing. It's all right for now as I'm still getting adapted to the new language/environment. -- Diane
-
- VIP Livecode Opensource Backer
- Posts: 7239
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: how to troubleshoot in iOS simulator?
You're probably right. If Console is throwing errors then the problem probably isn't related to LiveCode. I'm at a loss, since it's never happened to me. I suppose you tried all the regular things, like repairing permissions.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: how to troubleshoot in iOS simulator?
Hello Jacque, I wanted to tell you that "repairing permissions" worked! Now I can see the outputs that go to the message box, in my console app, Thanks!!! -- Diane
-
- VIP Livecode Opensource Backer
- Posts: 7239
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: how to troubleshoot in iOS simulator?
Great! It's good to know that worked. Now you can enjoy the pain of debugging without side effects.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com