Zend Studio 12 - Mobile App Debugging

General discussion on Zend Studio

Zend Studio 12 - Mobile App Debugging

Postby russ8421 on Fri Nov 21, 2014 3:39 pm

My question is, I've updated and now I would like to debug my mobile application. I see where I can debug the Apigility server side component, but I want to be able to debug the entire application. So Debug->Run As from the mobile side where I can set breakpoints in my.js and see what I'm outputting at that point. What is the best way to debug mobile applications? What Debug Configuration do I need?

Do I just need to launch index.html with the internal browser rather than the Sim?

Thank you for your assistance.
russ8421
 
Posts: 33
Joined: Sun Aug 18, 2013 11:31 pm

Re: Zend Studio 12 - Mobile App Debugging

Postby kaloyan_r on Mon Nov 24, 2014 12:51 pm

You are on Windows, don't you?

There is an integration between CordovaSim and Chrome DevTools. So, you start your mobile with CordovaSim, i.e. right-click on project > Run As > Run with CordovaSim. Then you right-click on the "device frame" of the simulator to bring up the context menu and choose Debug > Dev Tools... Then copy the provided link in your Chrome browser and you can now use all capabilities of Chrome Dev Tools, including JavaScript debugging.

We realize that it would be helpful to have the JavaScript debugging for mobile apps directly from Zend Studio. We are looking into it.

P.S. When you run your mobile app with CordovaSim, anything logged to console.log in your JS code, will be printed in the Console view of Zend Studio.
Kaloyan Raev
Zend Studio Team
User avatar
kaloyan_r
Zend Product Manager
 
Posts: 582
Joined: Thu May 23, 2013 12:40 pm

Re: Zend Studio 12 - Mobile App Debugging

Postby russ8421 on Mon Nov 24, 2014 1:36 pm

Actually, I'm running a Mac, but I did verify that this works.

I guess more specifically, how do I debug the mobile app with the Apigility created for the other project? I want to be able to click buttons in the Mobile Area and then set breakpoints in PHP in Zend Studio.

Thanks for any help!
russ8421
 
Posts: 33
Joined: Sun Aug 18, 2013 11:31 pm

Re: Zend Studio 12 - Mobile App Debugging

Postby kaloyan_r on Mon Nov 24, 2014 1:51 pm

russ8421 wrote:Actually, I'm running a Mac, but I did verify that this works.


All right, good to know! Just as a reference for any Linux users, it is also possible on Linux, but it is not available if you run Studio with OpenJDK, which is typically used by Linux users. The integration between CordovaSim and Chrome Dev Tools requires CordovaSim to be run with JavaFX. JavaFX is not available in OpenJDK, but in the Oracle JDK. So Linux users must install Oracle JDK and either run Studio with it or configure CordovaSim to run with it from the preference page in Studio. Then after running CordovaSim, they must go to Preferences... from the CordovaSim context menu, switch to the Settings tab and choose "JavaFX Browser" for Browser Engine. After restarting of CordovaSim, the integration with Chrome Dev Tools will be available.

russ8421 wrote:I guess more specifically, how do I debug the mobile app with the Apigility created for the other project? I want to be able to click buttons in the Mobile Area and then set breakpoints in PHP in Zend Studio.


There is no difference than debugging any other PHP application. When you click on a button on your mobile app will send a REST request to your Apigility project and if you have a debug session to your Apigility project then the breakpoint will be triggered.
Kaloyan Raev
Zend Studio Team
User avatar
kaloyan_r
Zend Product Manager
 
Posts: 582
Joined: Thu May 23, 2013 12:40 pm

Re: Zend Studio 12 - Mobile App Debugging

Postby russ8421 on Tue Nov 25, 2014 6:55 pm

I think what I'm missing is that when I setup a mobile project in Zend Studio, it places the files for the front end in the workspace, it then places the apigility component in the zend apache install folder. When I try to debug the front end, there is no debug configuration for it. If I copy that folder into apache htdocs and then try to debug it from, say, Firefox, using the Zend Toolbar, it just refreshes the page.

Strangely, if I use the Simple Services project, not only am I unable to debug anything via Zend Studio, I only get the static information to return. I see in the instructions it says it must be deployed. Well, since it defaults to the local server, I have only been able to get the other content to load if I deploy to OpenShift, which won't let me debug either.

So do I need to save everything to a different local area when I setup the project and then deploy to my localhost, both project folders (front end and apigility) to get debugging to work? Is there another set of instructions (a different tutorial) that says...install to here to develop; deploy to here to debug; here is the debug configuration for the mobile project?

I've been using Studio for years for PHP website development and I've always just setup a folder in apache and hit debug, either in Firefox Zend Toolbar or within eclipse.

Thanks for any assistance.
As it is I can still work but I'm back to the old-fashioned method of js popups and PHP prints to get my variable information.
russ8421
 
Posts: 33
Joined: Sun Aug 18, 2013 11:31 pm

Re: Zend Studio 12 - Mobile App Debugging

Postby kaloyan_r on Wed Nov 26, 2014 9:42 am

Check the first line in the www/js/my.js file of the mobile project. The 'gatewayURL' variable is the base URL for the REST calls. It is updated when the Apigility project is deployed. If you haven't deployed it, but just copied the project then it should still be like 'http://<no_php_server>/services'. You need to update it manually.

Note that if you set the URL to localhost, it will work only if you run the mobile project with CordovaSim. If you use the Android/iOS/WinPhone simulator then it won't, because then localhost is the localhost of the simulator VM, not the localhost of your workstation.
Kaloyan Raev
Zend Studio Team
User avatar
kaloyan_r
Zend Product Manager
 
Posts: 582
Joined: Thu May 23, 2013 12:40 pm

Re: Zend Studio 12 - Mobile App Debugging

Postby russ8421 on Wed Nov 26, 2014 11:47 am

I have the application working this way. The problem is that there is no obvious way to utilize Zend Studio to debug the PHP within. I enter the localhost into the simulator and it pulls right up. If I use the project where I've deployed to OpenShift, then the data will load as well. The problem is there is no way to debug PHP from the mobile side. I get debug configurations if I just run apigility but there aren't any for the mobile front end side. It is essentially a self-contained project that consists of just an index.html file. I don't think there is a debug configuration for it because it's not seeing any PHP for that project to actually set a breakpoint from. This is exactly because of the gatewayURL line you've mentioned.

Is it possible to setup a debug configuration from index.html that will know to stop at the breakpoints in the apigility project? The simple services mobile template contains the front-end and the backend in separate projects in the same workspace but debugging only seems to work on the backend [apigility] project. What I'm asking is if it's possible to set breakpoints in apigility that will stop while working from the front end.

So far this doesn't seem like a possibility. I can debug the front end javascript using Chrome or Firefox. I can debug just the backend using Zend Studio, though I'm not sure even how that will work once I start doing posts from there. The Test Service? I don't think that will stop at breakpoints though at least you get return values. But no debug configurations available from the front end that break in the apigility project for PHP.
russ8421
 
Posts: 33
Joined: Sun Aug 18, 2013 11:31 pm

Re: Zend Studio 12 - Mobile App Debugging

Postby kaloyan_r on Wed Nov 26, 2014 12:11 pm

I think what you need is to enable Debug Mode for Zend Server where the Apigility project is deployed. In debug mode Zend Server will trigger a debug session to Zend Studio for every incoming HTTP request. This way, whenever the mobile app send a REST request to the Apigility project you will get a debug session in Studio.

Here is the documentation regarding the Debug Mode: http://files.zend.com/help/Zend-Studio/content/using_debug_mode.htm
Kaloyan Raev
Zend Studio Team
User avatar
kaloyan_r
Zend Product Manager
 
Posts: 582
Joined: Thu May 23, 2013 12:40 pm

Re: Zend Studio 12 - Mobile App Debugging

Postby russ8421 on Mon Dec 01, 2014 10:50 pm

I performed the steps in the documentation provided. When I do a debug in the project from either Zend Studio or Firefox from the apigility admin area, it never stops on the first line, though that is what I selected. Nor does it stop on any other breakpoint I set. I do see that it started establishing an ssh connection to open shift, so that's a plus. Something is trying to happen. :)
russ8421
 
Posts: 33
Joined: Sun Aug 18, 2013 11:31 pm

Re: Zend Studio 12 - Mobile App Debugging

Postby kaloyan_r on Tue Dec 02, 2014 4:59 pm

Can you try on another Zend Server, not one running on OpenShift? We might have some issues with Debug mode on Zend Server @ OpenShift - we are looking at this right now.

Can you install Zend Server locally - there is 30 days free trial. There is also an opportunity to run it on AWS if you don't want to install it locally.
Kaloyan Raev
Zend Studio Team
User avatar
kaloyan_r
Zend Product Manager
 
Posts: 582
Joined: Thu May 23, 2013 12:40 pm

Next

Return to Zend Studio

Who is online

Users browsing this forum: No registered users and 2 guests

cron