Domanda

I'm working on building an iOS module for trigger.io. I have it working as desired within the ios-inspector app.

I've tried building the module following the docs here: https://trigger.io/docs/current/api/native_modules/the_basics.html#ios_2

I get a generated inspector/ios-inspector/build/module.a I then copy that module.a to module/ios/module.a

I then go into the trigger toolkit and bump the version number and upload the new module. Then in the toolkit app section I pick the new version of the module and build the app.

in my app code I do

  for(var prop in forge.my_module){
    console.log("prop==", prop, forge.my_module[prop]);
  }

and the only properties I get are:

[   INFO] Console.log: prop==,showAlert,function (c, b, a) {forge.internal.call("my_module.showAlert",{text:c},b,a);}

Which is the showAlert method from the original ios-inspector project. However I no longer have any Objective C code for that method.

I feel like I'm missing an obvious step here.

È stato utile?

Soluzione

Adding objective C API methods will allow you to call them like so:

forge.internal.call('my_module.my_method', {my_param: 2});

No JavaScript methods are generated for you, they're actually defined explicitly in module/javascript/module.js. The default module.js generated when making a module contains something like:

// Expose the native API to javascript
forge.my_module = {
    showAlert: function (text, success, error) {
        forge.internal.call('my_module.showAlert', {text: text}, success, error);
    }
};

You should be able to add your APIs there. See https://trigger.io/docs/current/api/native_modules/adding_javascript.html for more details.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top