Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Newbie question about plugins/UIKit - Gideros Forum

Newbie question about plugins/UIKit

lenalena Member
edited June 2012 in General questions
Hi, I am evaluating Gideros. I was really impressed when I saw the native plugins, UIKit is awesome. However, I am unclear on how to use it. My testing workflow was to export the project to xcode. Add the gideros.h file and the uikit.mm file to the project, and run in the simulator. That works great, but I have to repeat those steps every time I change something in my code. It doesn't seem possible to run the program in the Gideros Player because it doesn't recognize "ui" and I didn't see how to tell Gideros to include those two files in the xcode project. Am I missing something obvious?

I don't have a paid Apple Developer subscription at this moment. I thought I'd pay once I had a program to distribute, but if it is necessary for testing I could do so now.
Tagged:

Comments

  • ianchiaianchia Member
    edited June 2012
    Hello @lena, it took me a while to work out how to put it all together too, and I've been a long time Xcode ObjC and Corona developer. (;

    Here are a bunch of gotchas in no particular order. Maybe others will have the time to add it to the Gideros doc wiki, or blog about it and add their $0.02. I've been building a couple of more complex projects using the uikit plugin and modifying it. I hope by the end of July-ish, I'll be able to push my repo to github and Caroline/Mike and others can improve upon it even further.

    * Although you can work with your Xcode project anywhere in your hard drive, it's most convenient to have it live *INSIDE* the Gideros Studio directory under /Applications.

    eg. /Applications/Gideros Studio/my_gideros_xcode_project/my_gideros_xcode_project.xcodeproj (and all your other related assets in this folder along side the .xcodeproj)

    This is because the Xcode project generated by Gideros has dependencies that are pointed by *relative* paths in the Xcode project. So when Gideros release a newer version of the SDK (2.2.3 etc.) - all you have to do is to copy or move your project folder into the new SDK folder, and everything will continue to build linking to the newer dependencies.

    If your project is not living in the Gideros Studio folder, then when you compile, it'll complain about a bunch of missing files. If you drag the related Gideros files and add them into Xcode for it to compile, then you'll have to go thru the project by hand and remove them when you migrate the project to a newer SDK, and re-add them again. It got to be a pain for me, so now I move my Xcode projects inside the Gideros Studio folder.

    * With your Xcode project in the Gideros Studio folder, you then add the gideros.h file into the Xcode project, MAKING SURE YOU DON'T check the "Copy items into the destination group's folder (if needed)" option and you check the box for "Add to targets GiderosiPadPlayer". This ensures the gideros.h header file gets imported with relative path, so that the other .h includes within that file get resolved by Xcode correctly. There's an attached PNG to show what the settings should look like within Xcode (although note that I've appended my Gidero Studio folder with a version number - I like to keep track of SDK versions this way.)

    * With your Xcode project in the Gideros Studio folder, you then add the uikit.mm file to the Xcode project (not just copy straight into the directory, but add it using Xcode.)

    I can tell you are already doing this from your above description. I'm just re-explaining it for others to read later, if they're not familiar with Xcode. If you don't add the file to the Xcode project (copying the file itself into the folder structure using Finder etc is not good enough), it won't compile with it, and the app will crash as soon as you use the "ui" plugin within Lua.

    * When you are a paid developer, you can create a developer build that runs both on the simulator and on a device. Because my apps rely heavily on the uikit plugin, I don't use the Gideros Player at all. I just run my apps in the Xcode iOS Simulator, or on the device - using my compiled Gideros Player. You can find the Xcode projects in the GiderosiPhonePlayer.zip and GiderosiPadPlayer.zip in the Gideros Studio folder. I'm uncertain if you can create Simulator builds if you're not an Apple subscribed developer. I assume you can, but I've never been not, so can't tell you with any certainty. These Xcode compiled Gideros Players will establish a network connection to Gideros Studio, so you can change the IP address in the Studio under Player > Player Settings, and then run by selecting Player > Start.

    You can see this if you type this into a Terminal window:

    lsof | grep "Gideros" | grep "IP"

    Everything will work the same in these compiled Players as in the "official" desktop Gideros Player, but without the other non iOS screen resolutions. However, you won't get that annoying modal popup every time a Lua error occurs. You can also profile using Xcode's Instruments and other normal Xcode goodies. (;

    I use BBEdit as my Gideros IDE with the Lua syntax highlighting. I've also tweaked some Applescripts derived from @evs Applescripts for Sublime on this thread:
    http://www.giderosmobile.com/forum/discussion/comment/7275#Comment_7275 and setup some keyboard shortcuts to the menu options in the BBEdit Scripts menu.

    So in my BBEdit project, I hit Command R and the Applescripts move Gideros Studio to the front, does a Compile All, then Player > Start, which uploads any changes to the device or simulator. The AppleScript then moves the iOS Simulator window to the foreground, then the Gideros Studio app to the foreground (so I can watch the Output console), and finally my BBEdit window back to the foreground, so I can continue working. I've also have some accompanying scripts so it changes various IP addresses using Player > Player Settings, and hence I can quickly switch between the desktop iOS Simulator and the various devices on my desk with just a keystroke inside BBEdit.

    I'm very glad to have discovered Gideros. It's so much more productive having immediate code changes on my devices compared to the remote build system that Corona has, and not having to recompile my project using Xcode all the time also makes Gideros *far more* responsive to development.

    If anyone are interested in the Applescripts that I modified using @evs' templates, I can clean them up and post them here.

    As a bonus @lena (so long it's ok with @atilim et.al), here is a compiled iPad Gidero Player for the iOS Simulator. Just run the app, and it'll install itself into the iOS Simulator. Then you can test your uikit Gideros Studio apps on the desktop.

    https://www.dropbox.com/s/iohn0hkfrvrl70j/Gideros222_iPadSimulator_w_UIKit_plugin.dmg

    (The uikit.mm authors will note there are a bunch of extra methods now for UIWebView. :D Still a work in progress. I also renamed the uikit Button class because its unfortunate namespace collision with Gidero's Lua button class template.)

    gideros.h_xcode_settings.png
    257 x 162 - 22K
    +1 -1 (+5 / -0 ) Share on Facebook
  • gorkemgorkem Maintainer
    Added this link to Wiki, thank you.
  • lenalena Member
    Thank you so much for taking the time to write such a comprehensive comment and for sharing the compiled player! I appreciate it a lot. I now understand it better and it works perfectly now. It is amazing to be able to change lua code and see the results instantly in the xcode simulator.
  • I'm trying to build the playerproject in xcode (4) and followed the steps above get the following errors

    Undefined symbols for architecture i386:
    "gdr_willRotateToInterfaceOrientation(int)", referenced from:
    -[GiderosiPhonePlayerViewController willRotateToInterfaceOrientation:duration:] in GiderosiPhonePlayerViewController.o
    "gdr_didRotateFromInterfaceOrientation(int)", referenced from:
    -[GiderosiPhonePlayerViewController didRotateFromInterfaceOrientation:] in GiderosiPhonePlayerViewController.o
    "gdr_shouldAutorotateToInterfaceOrientation(int)", referenced from:
    -[GiderosiPhonePlayerViewController shouldAutorotateToInterfaceOrientation:] in

    Which show as 'Apple Mach-O Linker' errors. Not sure if its an architecture setting?

    Thanks


    Gary
Sign In or Register to comment.