GLBasic forum

Main forum => GLBasic - en => Topic started by: fjsantosb on 2010-Aug-16

Title: Launch GLBasic iPhone App from XCode UI Project
Post by: fjsantosb on 2010-Aug-16
Hi,

I am trying to integrate a GLBasic iPhone App with a XCode UI App.
The objective is to 'launch' an iPhone GLBasic App from an UI XCode Project.

What I have done:

- I create a simple GLBasic Application and compile for iPhone (simple helloworld text on screen).
- I tested (standalone) on iPhone and works.

- I create a simple ui application (a button with text 'launch glbasic app').
- I copy all libraries from GLBasic project to UI project.
- I add other linker flags, etc to get 2 projects exactly the same.

- I add the following code to UI project when press button. (I have defined the two methods and tested that nil arguments works).

-(IBAction) launchGLBasic:(id) sender {
   isIphone();
   GLB_iPhone_call_main(nil, nil);
}

- Applications UI runs pretty well, but when i press the button, application hang up for a second and then crash.

Any clue, I have missed something?

Any help will be appreciated!

Thanks in advance.

King regards, fjsantos.
Title: Re: Launch GLBasic iPhone App from XCode UI Project
Post by: trucidare on 2010-Aug-16
please add isIphone(); at program start. change all .m to .mm and try again.

write down the GDB log right here.
Title: Re: Launch GLBasic iPhone App from XCode UI Project
Post by: fjsantosb on 2010-Aug-16
Hi Trucidare,

As usual thanks for helping :).

I tried your solution but is not working :(.

Log is:

Code: GLBasic [Select]
2010-08-16 17:05:38.395 Integration[1580:207] *** _NSAutoreleaseNoPool(): Object 0x1070f0 of class NSCFString autoreleased with no pool in place - just leaking
Stack: (0x31399f83 0x3136d973 0x3136d93f 0x33380344 0x1be18 0x6a1b 0x69d0)
2010-08-16 17:05:40.745 Integration[1580:207] *** Assertion failure in UIApplicationInstantiateSingleton(), /SourceCache/UIKit/UIKit-984.38/UIApplication.m:1014
2010-08-16 17:05:40.753 Integration[1580:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'There can only be one UIApplication instance.'
2010-08-16 17:05:40.765 Integration[1580:207] Stack: (
    827030813,
    875630100,
    826579763,
    825897577,
    857005364,
    857002196,
    121240,
    27995,
    826787983,
    857368452,
    857368300,
    857368244,
    857367308,
    857370508,
    857364736,
    857362324,
    857343888,
    857342100,
    844315076,
    826778923,
    826776607,
    844309416,
    857009200,
    857002544,
    27229,
    27088
)
terminate called after throwing an instance of 'NSException'
Program received signal:  “SIGABRT”.
(gdb) continue
Program received signal:  “SIGABRT”.
(gdb) continue
Program received signal:  “0.
(gdb)
 

Thanks in advance!

King Regards, fjsantos.
Title: Re: Launch GLBasic iPhone App from XCode UI Project
Post by: trucidare on 2010-Aug-16
ok there is the problem...

2 UIApplication methods. hmm have to speak to kittie to solve this.
Title: Re: Launch GLBasic iPhone App from XCode UI Project
Post by: fjsantosb on 2010-Aug-16
Hi Trucidare,

Thanks so much, i will look forward for your solution :)

King Regards, fjsantos.
Title: Re: Launch GLBasic iPhone App from XCode UI Project
Post by: Kitty Hello on 2010-Aug-17
should I try to detect that and use the other instance instead?
Title: Re: Launch GLBasic iPhone App from XCode UI Project
Post by: fjsantosb on 2010-Aug-18
I really don't know what will be the best solution for this.

But your proposal makes sense to me.

With this method, I could regret to main app after 'end' command?

King Regards, fjsantos.
Title: Re: Launch GLBasic iPhone App from XCode UI Project
Post by: trucidare on 2010-Aug-18
hmm i think about a simple solution but not sure yet.
Title: Re: Launch GLBasic iPhone App from XCode UI Project
Post by: fjsantosb on 2010-Aug-18
That sounds great!

If you need a project for testing (for convenience), don't hesitate to contact me!

Thanks for your help.

King regards, fjsantos.