3

I have just discovered the extremely awesome RoboVM and wanted to try it out. For now, as a first step, all i want is to try the two samples on the "Get started" page. Unfortunately, i'm already stuck here.

I tried the command-line examples, not the eclipse plugin examples (i don't use eclipse).

The HelloWorld example worked perfectly. But i am having a problem with the IOSDemo example. It compiles fine with javac and seems to be processed correctly by RoboVM. The problem is that after the iPhone simulator has started up, the following is written to the terminal:

2014-06-01 07:14:25.820 IOSDemo[324:70b] Application windows are expected to have a root view controller at the end of application launch

and nothing is shown in the simulator (blank screen).

Here is the complete output and what i wrote in the terminal:

Xxxs-Mac:IOSDemo xxx$ javac -cp ../../../robovm-0.0.13/lib/robovm-rt.jar:../../../robovm-0.0.13/lib/robovm-objc.jar:../../../robovm-0.0.13/lib/robovm-cocoatouch.jar -d classes/ IOSDemo.java
Xxxs-Mac:IOSDemo xxx$ ../../../robovm-0.0.13/bin/robovm -verbose -arch x86 -os ios -cp ../../../robovm-0.0.13/lib/robovm-objc.jar:../../../robovm-0.0.13/lib/robovm-cocoatouch.jar:classes/ -run IOSDemo
Compiling IOSDemo (ios x86)
Compiling IOSDemo$1 (ios x86)
Linking 2009 classes
Building executable /var/folders/0y/k5k7wl3510d_7p8g6k9mjgc80000gn/T/robovm1960244380699928960.tmp/IOSDemo
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -o /var/folders/0y/k5k7wl3510d_7p8g6k9mjgc80000gn/T/robovm1960244380699928960.tmp/IOSDemo -g -arch i386 -Wl,-filelist,/var/folders/0y/k5k7wl3510d_7p8g6k9mjgc80000gn/T/robovm1960244380699928960.tmp/objects -L "/Volumes/My Disk/robovm/robovm-0.0.13/lib/vm/ios/x86" -ObjC -exported_symbols_list /var/folders/0y/k5k7wl3510d_7p8g6k9mjgc80000gn/T/robovm1960244380699928960.tmp/exported_symbols -Wl,-no_implicit_dylibs -Wl,-dead_strip -mios-simulator-version-min=5.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -lrobovm-bc -force_load "/Volumes/My Disk/robovm/robovm-0.0.13/lib/vm/ios/x86/librobovm-rt.a" -lrobovm-debug -lrobovm-core -lgc -lpthread -ldl -lm -liconv -lsqlite3 -framework Foundation -framework UIKit
Creating stripped archive file /var/folders/0y/k5k7wl3510d_7p8g6k9mjgc80000gn/T/robovm1960244380699928960.tmp/IOSDemo.app/lib/boot/robovm-rt.jar
Creating stripped archive file /var/folders/0y/k5k7wl3510d_7p8g6k9mjgc80000gn/T/robovm1960244380699928960.tmp/IOSDemo.app/lib/robovm-objc.jar
Creating stripped archive file /var/folders/0y/k5k7wl3510d_7p8g6k9mjgc80000gn/T/robovm1960244380699928960.tmp/IOSDemo.app/lib/robovm-cocoatouch.jar
Creating stripped archive file /var/folders/0y/k5k7wl3510d_7p8g6k9mjgc80000gn/T/robovm1960244380699928960.tmp/IOSDemo.app/lib/classes2.jar
Installing Info.plist to /var/folders/0y/k5k7wl3510d_7p8g6k9mjgc80000gn/T/robovm1960244380699928960.tmp/IOSDemo.app
xcrun dsymutil -o /var/folders/0y/k5k7wl3510d_7p8g6k9mjgc80000gn/T/robovm1960244380699928960.tmp/IOSDemo.app.dSYM /var/folders/0y/k5k7wl3510d_7p8g6k9mjgc80000gn/T/robovm1960244380699928960.tmp/IOSDemo.app/IOSDemo
warning: no debug symbols in executable (-arch i386)
"/Volumes/My Disk/robovm/robovm-0.0.13/bin/ios-sim" launch /var/folders/0y/k5k7wl3510d_7p8g6k9mjgc80000gn/T/robovm1960244380699928960.tmp/IOSDemo.app --timeout 90 --unbuffered --family iphone --retina --tall --args -rvm:log=warn
2014-06-01 07:14:25.820 IOSDemo[324:70b] Application windows are expected to have a root view controller at the end of application launch

As far as i can see there are no errors or warnings, apart from the error from the iOS simulator (and the line about debug symbols).

I use:
- Mac OSX 10.9
- RoboVM 0.0.13
- Javac 1.7.0_60 (also tried 1.8.0_05)
- XCode 5.1.1 (5B1008)
- (Simulator: iOS 7.1 (11D167))

I have never used a Mac before, have never used XCode before and do not know Objective-C yet either, so i'm not sure how to solve it. Googling the error seems to suggest that i need to add a line of code somewhere, but i'm not yet sure how to transform that to RoboVM yet, and since this is the example code copy/pasted from the website, i guess it should work out of the box with no modifications (right?). So something else is probably wrong. Hope some of you can see what is wrong. Any help would be appreciated. Thanx :)


EDIT: It works from eclipse, but still not from the command line. The error i mentioned above is also displayed in eclipse (see image below), but since it works anyway, that error is probably not the cause of the problem. Maybe the iOS simulator is just somehow launched incorrectly when i do it from the command-line?

DisplayName
  • 765
  • 6
  • 17
  • Please try following the section for Eclipse on the "Get started" page instead and see if that works better. – ntherning Jun 04 '14 at 06:50
  • I just tried it from eclipse, as you suggested, and i do get the same error. BUT it works in the iOS simulator anyway! (I see the "Click #x" text, where x increases each time i click). So maybe it is just launching the simulator from the command-line which i do wrong? (And maybe the error about the root view controller is really a warning?) – DisplayName Jun 10 '14 at 00:42

2 Answers2

1

I had the same error message logged in Eclipse, but the simulator started correctly and appeared to work anyway.

Jonathan Crosmer
  • 786
  • 5
  • 19
1

The example we have on the robovm site is a very basic demonstration of what robovm can do, rather than best practices.

Something like this might be a bit 'better' (not tested):

Main Application:

public class MainApplication extends UIApplicationDelegateAdapter {

UIViewController myViewController;


@Override
public boolean didFinishLaunching(UIApplication application,
                                  NSDictionary launchOptions) {

    if (myViewController == null) {
        myViewController = new MyViewController();
    }

    UINavigationController navigationController = new UINavigationController();
    navigationController.pushViewController(myViewController, true);

    CGRect bounds = new CGRect(0, 0, UIScreen.getMainScreen().getCurrentMode().getSize().width(),
            UIScreen.getMainScreen().getCurrentMode().getSize().height());


    UIWindow window = new UIWindow(bounds);
    window.setBackgroundColor(UIColor.colorWhite());
    window.makeKeyAndVisible();

    /* show everything */
    window.setRootViewController(navigationController);
    window.makeKeyAndVisible();

    return true;
}


/* Main entry point */
public static void main(String[] args) {
    NSAutoreleasePool pool = new NSAutoreleasePool();
    UIApplication.main(args, null, MainApplication.class);
    pool.close();
}
}

MyNavigationController:

public class MyViewController extends UIViewController {


@Override
public void viewDidLoad() {

    final UIButton button = UIButton.create(UIButtonType.RoundedRect);
    button.setFrame(new CGRect(115.0f, 121.0f, 91.0f, 37.0f));
    button.setTitle("Click me!", UIControlState.Normal);

    button.addOnTouchUpInsideListener(new UIControl.OnTouchUpInsideListener() {
        @Override
        public void onTouchUpInside(UIControl control, UIEvent event) {
            button.setTitle("Click #" + (++clickCount), UIControlState.Normal);
        }
    });
   getView().addSubview(button );
}
}
AshleyJ
  • 289
  • 4
  • 7
  • Thank you for your answer. It didn't help me with my command-line problem, but the way i worded my question (by making the faulty connection between the error message and that it didn't work from the commandline), i guess it does answer my question. If i still have problems compiling from the command-line the next time i get near a mac, i will open a new question for that :) Thanks again! – DisplayName Sep 18 '14 at 15:40