-1

I need a quick response please help me out, I just need to know a very basic thing in iPhone Titanium that how to call new window on button click. My application is running on android and I used these lines of code to call another window but it is not working on iPhone.

var MainMenuScreen = require('/ui/iphone/MenuScreen/MainMenuScreen');
MainMenu = new MainMenuScreen(json);
MainMenu.open();

But it doesn't work on iPhone, Please help me out quickly. As its just my login screen then I have to manipulate between many windows and views so how can I do that on iPhone.

danh
  • 62,181
  • 10
  • 95
  • 136
  • 2
    What is the problem? What errors are you getting? We are not mind readers. – Codeman Mar 26 '13 at 00:14
  • I have an APP on android using Titanium, and its running perfect. now I am going to convert it on iPhone, so i got many things to be changed for iOS. I use above code to open a new window or view in android but not working in iPhone and no error reporting. – Muhammad Kamil Mar 26 '13 at 00:25
  • Just hang on a single screen which is start of the APP. – Muhammad Kamil Mar 26 '13 at 00:25
  • Please help me out guys .. I know i cant clear things but I am stuck in it :( – Muhammad Kamil Mar 26 '13 at 00:29
  • You need to provide 1) a working example, and 2) the actual error that you are getting. What you've posted is like calling your doctor and saying, "IT HURTS!" and saying nothing more. We've got a 0% chance of helping you. – Dawson Toth Mar 26 '13 at 00:32
  • above code is an working example on android. just three lines can call a new window for me in android. lets say I have login screen and when user input correct username and password it will redirect to main screen in iPhone Titanium, validation checking through web service returned in JSON. – Muhammad Kamil Mar 26 '13 at 00:35
  • "Not working in iPhone" means absolutely nothing. What is not working? Is it force closing? Is it not showing up at all? – Codeman Mar 26 '13 at 00:46
  • Nothing happens. clicked on sign button call web service with correct response, when the response correct it should be redirect to another window but it stays on login screen – Muhammad Kamil Mar 26 '13 at 00:50

1 Answers1

0

Muhammad, make the following change in your code

var MainMenuScreen = require('ui/iphone/MenuScreen/MainMenuScreen');

I've removed the '/' from your path. Because It's just needed for android. Read Global method require. Also the above code will work for android also.

You can refer this answer also, which tells about navigation between windows.

Hope this resolved your issues

Community
  • 1
  • 1
Anand
  • 5,323
  • 5
  • 44
  • 58
  • Thanks alot Anand,it really works for me. I just want to know another thing that, to convert my application on iPhone from android I just copy all files and place them in a separate folder which hierarchy is (ui/iphone/..) and for the android version my hierarchy was (ui/common/..). I want to know that is there hierarchy matters in Titanium? and also it will be good for me to understand the working of handheld folder placed in "ui". I am asking this because when I run your solution to open a simple signup screen it will work but when I use it to open my main screen after login it stays on it – Muhammad Kamil Mar 26 '13 at 06:08
  • @MuhammadKamil: You don't need to copy the files. You just edit your current files. There might be small difference between android and ios. Since your codes are in the common folder, you just need to add platform specific codes where you need to add changes. That's why we use Titanium, here you just need to write single code for multiple platforms. You can use Ti.Platform.osname to identify the os you're working. Read http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Platform-property-osname – Anand Mar 26 '13 at 06:14
  • Thanks alot again @Anand. your answers really helpful for me. my app is running fine now on iPhone. I just ask one thing more from you, how to create IPA from Titanium for the distribution purpose. As it will test on more devices. – Muhammad Kamil Mar 26 '13 at 07:51
  • 1
    I found this to configure for archives and ipa http://webapp.org.ua/dev/preparing-adhoc-distribution-in-titanium-mobile/ and if you have Xcode 4.x http://stackoverflow.com/questions/9910211/how-to-create-an-ipa-on-xcode-4-3-2 see this answer i hope it will help others to find this. – Muhammad Kamil Mar 26 '13 at 08:25
  • @MuhammadKamil: Sorry for my late reply,since I was little busy. Please refer the following link for your question http://docs.appcelerator.com/titanium/latest/#!/guide/Preparing_for_Distribution. This will describe how to distribute your apps. Please read the sub contents of the link also :) – Anand Mar 26 '13 at 09:08
  • again thank you very much for your helpful answer, your guidance really help me to find out my problems. Thanks again +1 – Muhammad Kamil Mar 26 '13 at 18:15
  • Sorry to bother you again, I am having some issues in making IPA. I have send IPA file to my client but APP stuck on splash screen on his device. Do you know what was the reason? Also when I run my .xcodeproj file from Titanium iphone build it found around 50 issues on indexing. Is this the reason ? or else what is it. Please help me out again Thanks – Muhammad Kamil Mar 26 '13 at 20:34
  • @MuhammadKamil: Does your app using network connection? If so it might be because of the absence of network connection. I don't know the exact reason. Does it work in your device? – Anand Mar 27 '13 at 03:45
  • It is using network connection but It was not issue, there was cloud module included when I removed it my app works :) Thanks – Muhammad Kamil Mar 27 '13 at 20:46