How to integrate InApp purchase & native SDK for iOS with Haxe - ios

I'm trying to integrate InApp purchase & a native SDK provided by our publisher into a game made with Haxe & NME. I'm still using NME 3.5.5 & hxcpp 2.10.
I tried to use Native Extension as described here : http://www.openfl.org/developer/forums/programming-haxe/connecting-objective-c-haxe-ios-help/
and here : https://github.com/ericamccowan/Haxe_Extension_Test
I first tested it on windows, doing simple things in cpp, I had no problems passing and receving data.
I switched onto the mac, and tried to do the same for iOS, but I can't even manage to launch the game properly. I compiled the extension with the appropriate command, and then included the ".a" generated into the xcode project. But when I tried to run the game on an ipad via xcode, as usual, I got this :
(source: gyazo.com)
Here a look at what the project looks like
http://gyazo.com/ff6352a2bb7b2034c933b8305b711c48.png
Since the problem is localised on the "iOS_Native_register_prims()" in the Main.mm, I think it's a matter of xcode nor recognizing the native extension? I tried adding the iOS_Native.mm to the project, but then it threw an error because he was unable to include hxcpp.h
I realize I'm not really clear about all this, but that's because I don't quite understand how that should work... Does anyone ever tried something similar?
Thansk in advance for your help !

It sounds like you are missing a reference to the function iOS_Native_register_prims. The function declaration doesn't have to do anything other than return 0 but can also be used to initialize parts of your extension.
extern "C" int iOS_Native_register_prims () { return 0; }
The function name should match the project name so if you were creating a GameCenter extension it would be named GameCenter_register_prims.

Related

Semantic Issue: Cannot find the protocol declaration for ‘ARSessionDelegate’

Do anyone know the workaround for the build error on Xcode?
All suggestions are welcomed.
E.G: Impossible in that way, Possible with Objective-C, not Swift
Environment:
Swift:3.2, Xcode:9.2, Unity:2017.3.0f1, iOS:11.2.1
Condition:
I’m trying to make Native Plugin for Unity using Swift like this.
Unity C# -> Objective-C -> Swift
For now, I could access the iPhone camera roll from Unity.
The Project Name is GetDepthSample here.
Error Detail:
As soon as I add ARSessionDelegate on the class definition, I got the following error.
CameraRollSample.swift
Other Information:
GetDepthSample-Swift.h (generated automatically on Xcode) shows the following error.
GetDepthSample-Swift.h
It’s possible to jump to Definition of the protocol ARSessionDelegate.
Not only ARSessionDelegate but also MetalKit shows the similar error.
The original Unity Project
https://github.com/wapa5pow/CameraRollSample
Many thanks!
Looking at the header that you posted in the comment, it seems to me that maybe you need to include the ARKit framework in the project settings in Xcode. Although this generally tends to work automatically clearly something in your setup has that missing.

How to wrap existing iOS code in a new Appcelerator module?

This seems like a basic request, but I can't find the answer to it anywhere. I want to wrap some existing iOS code that I wrote, in a Appcelerator module. That's it. Important points:
I am NOT wrapping a pre-existing 3rd party iOS SDK.
I wrote the iOS code being wrapped.
Code is verified as working within xcode.
There are no .a files. There are 2x .h files and 2x .m files though.
There are no UI elements in the iOS code as it is only designed to connect the native bluetooth hardware to the app.
I have created a generic appcelerator iOS module project, built it, and successfully called the generic ID function within my app.
I cannot figure out how to successfully edit the generic module so that it utilizes my code. Every attempt results in it refusing to compile, and it's maddening.
I do not have access to Hyperloop.
Once I can successfully build the wrapped module, I would call an initialization function which triggers a native bluetooth hardware search. Once connected, there are functions within the module to send commands to the hardware and receive data back. This is the official documentation I've followed so far:
http://docs.appcelerator.com/platform/latest/#!/guide/iOS_Module_Quick_Start
That helped me build the blank module, include it in the app, and ensure that it worked by calling the built in test property. From there it stops short of actually telling me what I need to know. These are the closest things I've found so far, while still not being what I need:
http://docs.appcelerator.com/platform/latest/#!/guide/iOS_Module_Project-section-43288810_iOSModuleProject-AddaThird-PartyFramework
appcelerator module for existing ios project sdk
Heck, I still don't even know if I can do this within studio or if I have to edit the generic module in Xcode. Help! :) Many thanks in advance.
so first of all, this is not best practice and will cause possible problems in the future when the SDK changes and your module still relies on outdated core API's.
Regarding your question, you could either create a new component that subclasses the existing class, e.g.
class TiMyModuleListViewProxy : TiUiListViewProxy {
}
and call it with
var myList = MyModule.createListView();
or you write a category to extend the existing API with your own logic, e.g.
#interface TiUIListViewProxy (MyListView)
- (void)setSomethingElse:(id)value;
#end
#implementation TiUIListViewProxy (MyListView)
- (void)setSomethingElse:(id)value
{
// Set the value of "somethingElse" now
}
#end
I would prefer the second option since it matches a better Objective-C code-style, but please still be aware of the possible core-changes that might effect your implementation in the feature. Thanks!

Creating a Xamarin Binding project for PebbleKit iOS

For the past while I've been trying to create a binding project in Xamarin for PebbleKit iOS (the SDK for the Pebble smart watches). My hope is that in doing this I can create a Xamarin C# app that communicates with a Pebble smart watch, just like how you would in Objective - C.
Here is a link to the github page containing the code: https://github.com/dankunc/PebbleKit-Xamarin/tree/master
Also, here is a link to a simple harness project that just contains a button you can use to test out the binding project: https://github.com/dankunc/PebbleKit-Xamarin-Harness
Note: If any of you are kind enough to download the code and try it out, you'll probably need to update the reference path in the harness to the .dll in the binding project (PebbleKitAll/bin/release/PebbleKitAll.dll)
The project compiles, however when I go to use it in an actual Xamarin app, this code returns null to watch:
var watch = PBCentral.DefaultCentral();
In objective - c, the equivalent method would never return null, and I've been struggling with this for quite some time.
The PebbleKit binding project relies on two .frameworks from Pebble (PebbleKit and PebbleVendor) and a handful of other frameworks that get included in the harness project. I generated the ApiDefinition and StructsAndEnums files from using Objective Sharpie which I then cleaned up afterwards.
If anyone is able to help me with this, or if I need to provide more information or anything else, please let me know, and anything is appreciated. I've been struggling with this for quite a while and am at wits end. Thank you.

Creating an iOS library or framework using libgdx (roboVM)

Is it possible to create an iOS library or framework using libgdx (RoboVM) that can be imported into Xcode?
Background:
One of my colleagues has created a 3D visualisation app as a libgdx project for android and windows desktop. It can be compiled to run on iOS using RoboVM. However, I would like to wrap extra native user interface elements around it using Xcode. I know its possible to build the user interface programmatically via RoboVM but I would be keen to investigate if its possible to bring the existing work into Xcode. I don't need to edit the 3D visualisation component but add extra GUI elements around the 3D Vis window. I thought compiling the libgdx (RoboVM) code to a framework or library might be a solution that could be imported?!
Yes you can do it.
All you need to create a method, say initRoboVM(), This will be called by your code when you want to initialize libgdx. You'll need to pass the app path in, which you can hardcode when you're testing.
initRoboVM() will need some modifications, namely it should not call your Java app's main method, well, at least, that's what well behaving libraries should not do IMO. It should also not call rvmShutdown.
You can get further information from here
Thanks :)
I asked the RoboVM team directly. Their answer: It's not a native function, but it certainly can be done.
The complete message...
Hi,
Sorry for the late reply. This use case is not something we're going
to do now. It is possible though if you're prepared to do some
patching of RoboVM. Search the RoboVM Google Group and you should find
others who have managed to get this working.
We get this request every know and then so we will add support for
this eventually.
Regards, Niklas

DDMathParser & iOS7/XCode Compatibility

I added DDMathParser as a submodule in my Git repository, and after running it, the code only seems to work with OS X. Right away it gives me the following error in DemoController.h, etc.:
'Cocoa/Cocoa.h' file not found
Can DDMathParser work with a mobile device using iOS7? If so, it isn't clear to me how to accomplish this. My google search online suggests that Cocoa is not possible with iOS. I was able to get it working with Mac OS X - how can I do the same for iOS with my app?
DDMathParser author here. You've copied over more than you need. As the name implies, DemoController is part of a demo showing how the parser works. You shouldn't be including it in your app.
It definitely works with iOS 7. I copied it into my Xcode project folder and it parses like a champ. Can you try that first, then work on Git?

Resources