Using frameworks

fire

(jeremy) #1

Is it possible yet to use a Framework that was developed in Obj-C? I’m looking at using this https://github.com/kontaktio/kontakt-ios-sdk from this beacon company https://developer.kontakt.io/ios-sdk/quickstart/installation/ and would obviously prefer to do the job with Fire.

I want to build an iOS and Android app to detect beacons.


(JohnMoshakis) #2

Yes.

Ive been using train and headerimporter

https://docs.elementscompiler.com/Tools/HeaderImporter/

This is a train script to import purelayout

var hi = "/Users/JohnMoshakis/Documents/Elements/HeaderImporter.exe";
var fxBaseFolder = '/Users/JohnMoshakis/Documents/Elements/Toffee SDKs'; // where the SDK .fx files are
var developerFolder = '/Applications/Xcode.app/Contents/Developer';

include("../HeaderImporter/generate.train");

iOSSdkVersion="11.2" ;  // optionally, pick a target SDK

processiOSFramework({
    framework: "/Users/JohnMoshakis/Documents/develop/TrainScripts/PureLayout/Debug-iphoneos/PureLayout.framework",
    link: [],
    destinationFolder: "/Users/JohnMoshakis/Documents/develop/TrainOutput"
});

(marc hoffman) #3

Reminds me, I should add the import option for this to Fire’s Tools|FXGen menu, sometime soon.


(jeremy) #4

That would be awesome, that one would be good to test it on! I’m going to look at the iOS one first, android later (https://developer.kontakt.io/android-sdk/quickstart/).

In the meantime, I’ll look at John’s suggestion.


(marc hoffman) #5

Yeah, I’ll see if I can add that this week, should be straight-forward, given that the Xcode import one is already integrated.


(jeremy) #6

I see it didn’t get into today’s build, am I right in thinking that I need to build train with VS, or can I do that with Fire too? I just tried with today’s and it didn’t build (failed on GenerateResources) so I’m guessing I’ll have to go the windows route?


(marc hoffman) #7

You can build Train in Fire too. or use the Train.exe that ships inside fire. (the UI just barely didn’t make it, need rot do more tweaks/testing before I can enable it, hopefully for next week)


(marc hoffman) #8

That’s xbuild for you. buggy. Use EBuild.


(jeremy) #9

Ah yes, ta. Forgot I’d flipped that. That did it.


(marc hoffman) #10

Shame on you :wink:


(jeremy) #11

In my defence, it was when something worked but didn’t on EBuild. My current project doesn’t build in the latest though. I’ll log it.


(marc hoffman) #12

How short ago was that? I chnaged the setting that controls EBuild vs XBuild just a few weeks back (so that EBuild would default to true anew for anyone who turned it on and back off in the past), bunt didn’t recall any EBuild specific reports from you since…

yeah, that one’s not an EBuild bug. At this stage EBuild is more solid then xbuild in all cases i’m aware of.


(jeremy) #13

Ages ago. I don’t recall changing it recently.


(marc hoffman) #14

weird, then. I’ll double-check which settings it reads, again…


(jeremy) #15

I gave it a go, but am getting an error during the import, so perhaps I should wait for the import option to be added, unless you can guess what this may be?

      function doProcessLibrary([object Object]) {
        folder.create(/Users/Jeremy/Documents/Elements/TrainOutput/KontaktSDK/iOS/armv7-apple-ios) { }
        function runHeaderImporterForLibrary([object Object],  --fxpaths "/Users/Jeremy/Documents/Elements/Toffee SDKs/iOS 11.2" --copyframework) {
          import --architecture=armv7-apple-ios -o "/Users/Jeremy/Documents/Elements/TrainOutput/KontaktSDK/iOS/armv7-apple-ios" -f "/Users/Jeremy/Documents/BitBucket/kontakt-ios-sdk/KontaktSDK/iOS" --importframework=KontaktSDK --type=ios  --fxpaths "/Users/Jeremy/Documents/Elements/Toffee SDKs/iOS 11.2" --copyframework -q objc/NSObject.h:Foundation -q objc/NSObjCRuntime.h:Foundation
          shell.exec(/Users/Jeremy/Documents/Elements/HeaderImporter.exe import --architecture=armv7-apple-ios -o "/Users/Jeremy/Documents/Elements/TrainOutput/KontaktSDK/iOS/armv7-apple-ios" -f "/Users/Jeremy/Documents/BitBucket/kontakt-ios-sdk/KontaktSDK/iOS" --importframework=Konta...) {
            Failed with error code: 1
            Output:

Unhandled Exception:
System.TypeLoadException: Could not load type ‘HeaderImporter.CodeGen’ from assembly ‘HeaderImporter, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null’.
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type ‘HeaderImporter.CodeGen’ from assembly ‘HeaderImporter, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null’.

            Error calling Process.Execute: Failed with error code: 1

System.Exception: Failed with error code: 1
at RemObjects.Train.API.Shell.Exec (RemObjects.Script.EcmaScript.ExecutionContext ec, System.Object aSelf, System.Object[] args) [0x003b9] in :0
} shell.exec(/Users/Jeremy/Documents/Elements/HeaderImporter.exe)
} function runHeaderImporterForLibrary


(marc hoffman) #16

The Import UI will literally create and run the same script you’re running, so better we get this sorted out beforehand…

Hmm, is that with a recent v10 build? sounds like a reference mismatch.


(jeremy) #17

I took everything from inside Fire (Train folder/headerimporter/generate.train/toffee sdks) as I assumed that was how it would work, plus installed the same mono as Fire has internally.


(marc hoffman) #18

Ok, that’s fine. But a recent Fire, eg 2249 or 2251? It sounds like HeaderImporter.exe is missing some reference assemblies. Can you try if installing the matching external compiler fixed it?


(jeremy) #19

Yes, I tried both those builds actually, same result. External compiler. Ah. I notice in Fire that external elements was not found. Never needed it. Installed the same one all in 2251. Now it does something!

Went through lots of files, and failed with something it didn’t like:

KTKDeviceAdvertisingPacketsKontaktTLM      = 1 << 8,

The last line that was good

    /**
     *  All supprted Eddystone packets.
     */
    KTKDeviceAdvertisingPacketsEddystoneAll    = (NSInteger)0b00000000000000000000000000011100,
    /**
     *  All supprted Eddystone Secure (EID + ETLM).
     */
    KTKDeviceAdvertisingPacketsEddystoneSecure = (NSInteger)0b00000000000000000000000001100000,
    /**
     *  All supprted packets.
     */
    KTKDeviceAdvertisingPacketsAll             = (NSInteger)0b11111111111111111111111111111110
};

This is the part it stopped at, error below:

======
An error occurred: HeaderImporter.ParserException: KontaktSDK/KTKDeviceDefinitions.h (141:62 pp: 11099) closing brace expected; current token: Identifier (b00000000000000000000000000011100)
Surrounded by:
at HeaderImporter.CParser.RaiseError (System.String aError) [0x00136] in :0
at HeaderImporter.CParser.Expect (HeaderImporter.TokenKind aToken) [0x00022] in :0
at HeaderImporter.CParser.ParseEnum (HeaderImporter.CType aPrev) [0x00266] in :0
at HeaderImporter.CParser.ParseType (System.Boolean aAllowQualifier, System.Boolean aAnyIdent) [0x008af] in :0
at HeaderImporter.CParser.ParseDeclSpec (System.Boolean aOpt, System.Boolean aAllowStorageClass) [0x0061f] in :0
at HeaderImporter.CParser.ParseDeclaration (System.Boolean aAllowFunction, System.Action`1[T] aAddToParent, System.Boolean aALlowIn) [0x00036] in :0
at HeaderImporter.CParser.Parse () [0x00054] in :0
at HeaderImporter.Import.DoImportWithState (System.String aFileName) [0x003fb] in :0

            Error calling Process.Execute: Failed with error code: 1

System.Exception: Failed with error code: 1
at RemObjects.Train.API.Shell.Exec (RemObjects.Script.EcmaScript.ExecutionContext ec, System.Object aSelf, System.Object[] args) [0x003b9] in :0
} shell.exec(/Users/Jeremy/Documents/Elements/HeaderImporter.exe)
} function runHeaderImporterForLibrary
} function doProcessLibrary
} function processLibrary
} function processiOSDeviceLibrary


(marc hoffman) #20

That’s a HI bug for Carlo. Can you send me the .framework?