2016-11-26 18 views
1

私のリアクションネイティブFirebase APLに奇妙なエラーがあります。NSnull型のJSON値をNSStringに変換できません

反応しないネイティブrun-androidはエラーなく正常に動作します。

しかし、NSnull型のJSON値で反応ネイティブrun-iosが失敗し、NSStringに変換できません。次のように

ソースコードがある。(firebase上の認証作業をメインとサインアップクラス)

私はFirebaseクラスはJSONをテキストに変換するには、IOSとAndroid上の異なるACTを持っていると思います。

ご了承ください。

商事

メイン

//ここfirebaseアプリを初期化し、必要に応じて他のコンポーネントに渡します。起動時にのみ初期化します。

const firebaseApp = firebase.initializeApp(firebaseConfig); 

    var GiftedMessenger = require('react-native-gifted-messenger'); 

    let styles = {} 

    class Pricing extends Component { 

    constructor(props){ 

    super(props); 

    this.state = { 

    page: null 

    }; 

    /* this.itemsRef = this.getRef().child('items'); */ 

    } 

    componentWillMount(){ 

    // We must asynchronously get the auth state, if we use currentUser here, it'll be null 

    const unsubscribe = firebaseApp.auth().onAuthStateChanged((user) => { 

    // If the user is logged in take them to the accounts screen 

    if (user != null) { 

    this.setState({page: Account}); 

    console.log('(user != null)') 

    return; 

    } 

    // otherwise have them login 

    console.log('(user != Login)') 

    this.setState({page: Login}); 

    // unsubscribe this observer 

    unsubscribe(); 

    }); 

    } 

    render() { 

    if (this.state.page) { 

    return (

    // Take the user to whatever page we set the state to. 

    // We will use a transition where the new page will slide in from the right. 

    <Navigator 

    initialRoute={{component: this.state.page}} 

    configureScene={() => { 

    return Navigator.SceneConfigs.FloatFromRight; 

    }} 

    renderScene={(route, navigator) => { 

    if(route.component){ 

    // Pass the navigator the the page so it can navigate as well. 

    // Pass firebaseApp so it can make calls to firebase. 

    return React.createElement(route.component, { navigator, firebaseApp}); 

    } 

    }} /> 

); 

} else { 

return (

// Our default loading view while waiting to hear back from firebase 
+0

エラーは非常に具体的です。質問は同じことを試みるべきです。 – user2864740

+0

私のAPLと呼ばれるCLASS firebaseは以下の通りです。 const firebaseApp = firebase.initializeApp(firebaseConfig); CONST解除= firebaseApp.auth()。onAuthStateChanged((ユーザー)=> { this.props.firebaseApp.auth()。createUserWithEmailAndPassword( CONSTのuserData = this.props.firebaseApp.auth()。あるCurrentUser; ソース= {{URI:this.state.user.photoURL}}それが完了したら/> //ログアウト、ログイン画面にユーザを戻す this.props.firebaseApp。 auth()。signOut()。then(()=> { – itagaki

答えて

0

このBUGでは深くデバッグします。 最後に私は次のように見つけました。

<Image 
source={{uri: 'this.state.user.photoURL'}} <<<single quotation was added. 
style={styles.image} 
/> 

この種のエラーは予期しませんでした。

ありがとうございます。

+0

なぜiosとAndroidは一重引用符を使用しないで別の操作を行うのですか? – itagaki

関連する問題