Open External iOS application

88 views
Skip to first unread message

joecz...@gmail.com

unread,
Sep 11, 2014, 5:05:22 PM9/11/14
to codenameone...@googlegroups.com
I am trying to open Instagram when the user clicks a button. I don't see support from CodenameOne to open external applications so I created a native interface. However on iOS debug build it fails.

I literally copied the tutorial from the How Do I section and that worked fine but then I added the following two lines.
I think it might have to do with [UIApplication sharedApplication].

-(NSString*)sayHi:(int)param param1:(NSString*)param1 param2:(NSData*)param2{

       if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"instagram://user?username=joezoob"]]) {

       [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"instagram://user?username=joezoob"]];

}

return @"Hi";

}


Here is a snippit from the error log. 
** BUILD FAILED **

The following build commands failed:
CompileC build/Main.build/Release-iphoneos/Main.build/Objects-normal/armv7/com_insideoutlier_theave_MyNativeImpl.o /var/folders/p7/d3z112yd0156kxkm2p21p8ym0000gn/T/build6983613762723567913xxx/build/xcode/src/app/com_insideoutlier_theave_MyNativeImpl.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)


Any ideas why this isn't working? Or another option for opening an external app on iOS using url schemes?

Shai Almog

unread,
Sep 12, 2014, 4:43:58 AM9/12/14
to codenameone...@googlegroups.com, joecz...@gmail.com
Actually we support it: http://www.codenameone.com/blog/can-execute

That's not the build error.
Search the file for com_insideoutlier_theave_MyNativeImpl and you will see the actual build error.

FYI Your code is problematic though since it executes on the Codename One calling thread and not on the native iOS main thread.

joecz...@gmail.com

unread,
Sep 12, 2014, 10:27:02 AM9/12/14
to codenameone...@googlegroups.com, joecz...@gmail.com
Awesome! That's exactly what I needed. Thanks! 
Reply all
Reply to author
Forward
0 new messages