簡體   English   中英

trigger.io本機iOS模塊可在檢查器中運行,而不在應用程序中運行

[英]trigger.io native iOS module works in inspector, not app

我正在為trigger.io構建iOS模塊。 我有它在ios-inspector應用程序中按需要工作。

我已經嘗試根據此處的文檔構建模塊: https : //trigger.io/docs/current/api/native_modules/the_basics.html#ios_2

我得到一個生成的inspector/ios-inspector/build/module.a ,然后將那個module.a復制到module/ios/module.a

然后,我進入觸發器工具箱並修改版本號並上傳新模塊。 然后在工具箱應用程序部分中,選擇新版本的模塊並構建應用程序。

在我的應用程序代碼中

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

我得到的唯一屬性是:

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

這是原始ios-inspector項目中的showAlert方法。 但是,我不再有該方法的任何Objective C代碼。

我覺得我在這里缺少明顯的步驟。

添加目標C API方法將使您可以像這樣調用它們:

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

沒有為您生成任何JavaScript方法,它們實際上是在module/javascript/module.js明確定義的。 制作模塊時生成的默認module.js包含以下內容:

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

您應該能夠在此處添加API。 有關更多詳細信息,請參見https://trigger.io/docs/current/api/native_modules/adding_javascript.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM