2017-04-13 150 views
0

在使用Appcelerator SDK 5.5.1.GA執行構建時,在調用xcodebuild之後,它會拋出一個錯誤,並且文本無法讀取屬性'emit'爲null。它曾經工作得很好,直到上週。只有在我製作AdHoc或生產IPA時纔會發生這種情況。它在模擬器中啓動時沒有任何問題。無法讀取屬性'emit'null

如果我通過Studio或使用控制檯進行操作,就會發生這種情況。如果來自社區的任何人遇到了這個問題,請讓我知道。如果我使用5.5.0.GA這樣的舊SDK,那麼構建工作正常。

的XCode:7.3.1 節點:0.12.7

+0

如果我們從命令行執行xcodebuild,那麼它工作正常,我們可以從中生成IPA。不確定爲什麼它在Studio中執行時不起作用。 – Soumya

+0

這與調用invokexcodebuild函數的_builds.js有關。如果我從此呼叫返回,則其他代碼正確流通。 – Soumya

+0

我已經添加了爲我工作的過程。這似乎是一個時間問題。所以在兩階段構建中,它工作正常。我也加了我自己的方法。 – Soumya

回答

0

除了我的開發人員提到的上述過程之外,以下工作也不會對環境做任何改變。這將需要兩階段構建。

供參考,讓我們使用這個鏈接以供參考: Appcelerator iOS Build JS (_build.js)

要解決此問題,可以從終端

appc run --build-only -T dist-adhoc --project-dir ~/Code/MyApp 

一旦構建開始啓動建設,讓它經歷和等到

調用的Xcode

被調用並引發錯誤。一旦引發錯誤,轉到以下文件夾:

編譯/ iphone /編譯/產品/新聞稿 - iPhone

裏面有你會發現APP文件和文件DSYM。如果沒有,等待2-3分鐘,XCode構建的後臺進程將完成。一旦看到這兩個文件,在這種情況下打開SDK的_build.js(5.5.1.GA)。您可以在構建開始時找到在控制檯中顯示的路徑。

打開_build.js文件,然後轉到下面的函數

iOSBuilder.prototype.run = function (logger, config, cli, finished) 

裏面有,你會發現一個一系列它具有所有的函數調用。在這裏您需要進行以下更改:

function (next) { 
     cli.emit('build.pre.construct', this, next); 
    }, 

    // initialization 
    //'doAnalytics', 
    'initialize', 
    'loginfo', 
    //'readBuildManifest', 
    //'checkIfNeedToRecompile', 
    //'initBuildDir', 

    /* 
    function (next) { 
     cli.emit('build.pre.compile', this, next); 
    }, 

    function() { 
     // Make sure we have an app.js. This used to be validated in validate(), but since plugins like 
     // Alloy generate an app.js, it may not have existed during validate(), but should exist now 
     // that build.pre.compile was fired. 
     ti.validateAppJsExists(this.projectDir, this.logger, ['iphone', 'ios']); 
    }, 

    // xcode related tasks 
    'createXcodeProject', 
    'writeEntitlementsPlist', 
    'writeInfoPlist', 
    'writeMain', 
    'writeXcodeConfigFiles', 
    'copyTitaniumLibraries', 
    'copyTitaniumiOSFiles', 
    'copyExtensionFiles', 
    'cleanXcodeDerivedData', 

    // titanium related tasks 
    'writeDebugProfilePlists', 
    'copyResources', 
    'encryptJSFiles', 
    'writeI18NFiles', 
    'processTiSymbols', 

    // cleanup and optimization 
    'removeFiles', 
    'optimizeFiles', 

    // provide a hook event before xcodebuild 
    function (next) { 
     cli.emit('build.pre.build', this, next); 
    }, 

    // build baby, build 
    'invokeXcodeBuild', 

    */ 

    // provide a hook event after xcodebuild 
    function (next) { 
     cli.emit('build.post.build', this, next); 
    }, 

    // finalize 
    'writeBuildManifest', 

    function (next) { 
     if (!this.buildOnly && (this.target === 'simulator' || this.target === 'device')) { 
      var delta = appc.time.prettyDiff(this.cli.startTime, Date.now()); 
      this.logger.info(__('Finished building the application in %s', delta.cyan)); 
     } 

     cli.emit('build.post.compile', this, next); 
    }, 

    function (next) { 
     cli.emit('build.finalize', this, next); 
    } 

現在再次運行appc run命令。現在,這將採取最後的構建並準備IPA。這是一個漫長的過程,但在沒有任何環境變化的情況下完成工作。

0

嘗試升級到NPM(3.X)的新版本。我已經看到與其他非Appcelerator項目的問題。

0

您可以通過終端下面的命令和乾淨的構建「項目>>乾淨」嘗試

  • APPC註銷
  • APPC登錄

而且,我看你是使用相當老版本的Ti SDK,Xcode和節點。所以你可以更新你的環境然後嘗試。 - https://platform.appcelerator.com/#/product/cli

希望這會有所幫助。

0

我終於成功了,沒有遷移我所有的環境。剛剛更新Appcelerator的CLI,合金和節點

首先更新您的Appcelerator的CLI

sudo npm install -g appcelerator 
appc setup 

然後,你需要更新合金1.8.0+

sudo npm install -g alloy 

下一頁修改您的項目以反映合金1.8 0.0先決條件:http://www.appcelerator.com/blog/2016/03/alloy-1-8-relocates-i18n-and-platform-directories/

- >移動你/ i18n中和/平臺目錄/應用/ i18n中和/應用/平臺

最後重新啓動您的計算機。這裏

PS是我的新配置:

  • 工作室4.5.0
  • SDK 5.2.0.GA
  • 的XCode 7.3.1
  • NPM 2.14.7
  • 節點4.2。 0
  • CLI 5.0.12
+0

您是否面臨與發射屬性爲空的相同問題?它也發生在Android上嗎? – Soumya