Need help with iOS - trying to make a plugin or at least make some code work with a native build for now.

I’m trying to make a native SDK work with one of our projects, with any luck we would eventually be able to release this as a plugin but would need to discuss that with the SDK provider first. For the moment I’m just building it into my project directly. 

For the Android version, I had very few problems. I can call their functions with some params, get the data back and pass that back to lua (basically I just need to call init, load and show so it’s fairly simple in theory). However with the iOS version, I’m having nightmare after nightmare (admittedly I have very little experience with iOS development).  I have 2 main problems:

Edit: fixed see next post

The sample code that the SDK provider gave me assumes that you will be writing a native project and is very much tied into .xib files, with delegates/files owners and loads of other stuff we don’t deal with in corona. I managed to get to the point where I can call the SDK’s function from Lua using timer.performWithDelay and bypass all of their interface builder button presses. Great I thought, so I then tried to make a button in corona and add the sdk functions to that only to find that no touch events reach the corona code. 

My guess is that the SDK’s xib file is ‘stealing’ the touches. I’ve tried disabling ‘User Interaction Enabled’ on all objects in the xib, but still no touches reach the corona code. I can see my corona objects on the screen though, so making the xib views hidden as worked.

Is there a way for me to make the MainWindow.xib file “live”? If someone knows how and could give me eli5 instructions I would really appreciate that as it’s driving me mad.

I took the pluginlibrary.h/.mm code as a starting point, so I now have a file which can interact with lua and that works ok. But how do I pass info from another .mm file to that pluginlibrary file in order to pass back data from the other file to lua? When I call the code directly from my corona code it seems like it passes the luastate in automatically, but from another file I don’t see how I would do that.

I’m guessing that some of these issues will be really obvious to someone with a bit more experience, but as I say I don’t really have any experience with native development and I’m finding it much much harder than the android side of things. I can paste in some code if that would be helpful, but the ios project seems like a maze to me so not even sure what would be helpful to paste here.

So the first point has been fixed thanks to another dev who gave me the answer over skype. I was calling this:

self.viewController = [[MySDKViewController alloc] initWithNibName:@"MySDKViewController" bundle:nil]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.rootViewController = self.viewController;

I did need the first line to initialise some stuff, but the next 2 lines were unnecessary.

So the first point has been fixed thanks to another dev who gave me the answer over skype. I was calling this:

self.viewController = [[MySDKViewController alloc] initWithNibName:@"MySDKViewController" bundle:nil]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.rootViewController = self.viewController;

I did need the first line to initialise some stuff, but the next 2 lines were unnecessary.