2017-02-13 35 views
0

在嘗試掛鉤AFRAME內反應本地的,但在仿真器啓動時,我得到這個錯誤:反應,和/ AFRAME對象分配錯誤

One of the sources for assign has an enumerable key on the prototype chain. Are you trying to assign a prototype property? We don't allow it, as this is an edge case that we do not support. This error is a performance optimization and no spec compliant. 

我使用AFRAME 0.5.0和應對本土0.41.2

錯誤從polyfills.js的第56行拋出,並且涉及到aframe-master.js:55729的這一部分。

Object.assign(THREE.MTLLoader.prototype, THREE.EventDispatcher.prototype, { 

有沒有辦法解決這個問題?我是否需要修改框架以使用不同的任務,或者有什麼方法可以解決這個問題?

我正在運行一個非常簡單的Hello World,它只是試圖加載依賴關係失敗。在其他相關的問題上,人們說他們已經通過使用lodash.assign或Object.defineProperties來解決它 - 這是一個可行的解決方案嗎?在此期間,我可以恢復到較早版本的react-native,但我最好喜歡使用最新的a-frame。

https://github.com/facebook/react-native/issues/5507

https://github.com/facebook/react-native/issues/3634

**更新** 好吧,我試着回滾,安裝反應母語0.36.1和交換我加載在WebView中來AFRAME使用0.3.2網站。

我在陣營本機應用程序的代碼是這樣的:

好吧,我試着回滾,安裝使用rninit反應本地0.36.1和交換我加載在WebView中來AFRAME使用本網站0.3.2。

我在陣營本機應用程序的代碼是這樣的:

import React, { Component } from 'react'; 
// import ReactDOM from 'react-dom'; 
import { 
    AppRegistry, 
    WebView 
} from 'react-native'; 

export default class test4 extends Component { 
    render() { 
    return (
     <WebView source={{uri: 'http://[theurl]/test.html'}}/> 
    ); 
    } 
} 


AppRegistry.registerComponent('test4',() => test4); 

的AFRAME應用程序是這樣的:

<!DOCTYPE html> 
<html> 
    <head> 
     <title>A-Frame walkthrough (final)</title> 
     <script src="/aframe.js"></script> 

    </head> 
<body> 
    <a-scene> 
    <a-assets> 
     <img id="circle" src="circle.png"/> 
    </a-assets> 


     <a-sky src="Ephesus4_1.jpg" rotation="0 -130 0"></a-sky> 
    </a-scene> 

</html> 

當我從Chrome檢查的WebView打開調試器://檢查#設備,我得到這個輸出:

Mozilla/5.0 (Linux; Android 6.0; Android SDK built for x86_64 Build/MASTER; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/44.0.2403.119 Mobile Safari/537.36 
aframe.js:54681 Recalculating device params. 
aframe.js:54718 User agent: Mozilla/5.0 (Linux; Android 6.0; Android SDK built for x86_64 Build/MASTER; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/44.0.2403.119 Mobile Safari/537.36 
aframe.js:54719 Pixel width: 2562 
aframe.js:54720 Pixel height: 1442 
aframe.js:54762 No DPDB device match. 
aframe.js:54683 New device parameters: 
aframe.js:54684 null 
aframe.js:54692 Failed to recalculate device parameters.Dpdb.recalculateDeviceParams_ @ aframe.js:54692 
aframe.js:54654 Fetching DPDB... 
aframe.js:53106 Using fallback Android device measurements. 
aframe.js:56388 Failed to load viewer profile: TypeError: Cannot read property 'getItem' of null 
    at Emitter.ViewerSelector (http://ec2-52-62-186-186.ap-southeast-2.compute.amazonaws.com:8080/aframe.js:56386:36) 
    at VRDisplay.CardboardVRDisplay (http://ec2-52-62-186-186.ap-southeast-2.compute.amazonaws.com:8080/aframe.js:52607:26) 
    at WebVRPolyfill.populateDevices (http://ec2-52-62-186-186.ap-southeast-2.compute.amazonaws.com:8080/aframe.js:56694:17) 
    at WebVRPolyfill.getVRDisplays (http://ec2-52-62-186-186.ap-southeast-2.compute.amazonaws.com:8080/aframe.js:56743:8) 
    at new THREE.VRControls (http://ec2-52-62-186-186.ap-southeast-2.compute.amazonaws.com:8080/aframe.js:66848:13) 
    at Object.119.../lib/three (http://ec2-52-62-186-186.ap-southeast-2.compute.amazonaws.com:8080/aframe.js:66227:16) 
    at s (http://ec2-52-62-186-186.ap-southeast-2.compute.amazonaws.com:8080/aframe.js:1:620) 
    at http://ec2-52-62-186-186.ap-southeast-2.compute.amazonaws.com:8080/aframe.js:1:671 
    at Object.122../bind (http://ec2-52-62-186-186.ap-southeast-2.compute.amazonaws.com:8080/aframe.js:66358:25) 
    at s (http://ec2-52-62-186-186.ap-southeast-2.compute.amazonaws.com:8080/aframe.js:1:620)ViewerSelector @ aframe.js:56388 
aframe.js:53096 Uncaught TypeError: Cannot read property 'distortionCoefficients' of undefined 
aframe.js:54662 Successfully loaded online DPDB. 
aframe.js:54681 Recalculating device params. 
aframe.js:54718 User agent: Mozilla/5.0 (Linux; Android 6.0; Android SDK built for x86_64 Build/MASTER; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/44.0.2403.119 Mobile Safari/537.36 
aframe.js:54719 Pixel width: 2562 
aframe.js:54720 Pixel height: 1442 
aframe.js:54762 No DPDB device match. 
aframe.js:54683 New device parameters: 
aframe.js:54684 null 
aframe.js:54692 Failed to recalculate device parameters.Dpdb.recalculateDeviceParams_ @ aframe.js:54692 
http://ec2-52-62-186-186.ap-southeast-2.compute.amazonaws.com:8080/favicon.ico Failed to load resource: the server responded with a status of 404 (Not Found) 

任何建議,將不勝感激!

com.facebook.react.common.JavascriptException:

我也是在Android模擬器本身得到這個{ 「堆疊」:「錯誤:未能執行的 'WorkerGlobalScope' importScripts」:該在http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false「腳本加載失敗。\ n在executeApplicationScript(http://localhost:8081/ebuggerWorker.js:207)\ n在的onMessage(http://localhost:8081/debuggerWorker.js:38.5)」}

我得到即使我切換到web視圖加載非AFRAME網站同樣的錯誤。

+0

嗨Toby,你能發佈reactjs和aframe的版本嗎? –

+0

Yep Aframe 0.5.0和React-native 0.41.2已添加到問題 –

+0

我的成功部署使用了框架0.3.2和React-native 0.36.1。我建議你降級測試。同樣基於你的研究,這個問題似乎更多地涉及反應原生的結局。你有沒有嘗試在你的應用中加載原生webview而不是反應? –

回答

0

經過大量的搞亂之後,我發現我的很多問題是由於試圖在模擬器中測試。

在設備上運行時,我能夠獲得運行最新版本的react-native的最新版本的應用程序,但只能通過設置react-native來從源代碼重新編譯android項目,從當前的主人拉。我不得不在Android.Manifest中啓用硬件加速。

感謝Chris Chen的幫助