【问题标题】:Json value NSDictionary conversionJson值NSDictionary转换
【发布时间】:2017-05-27 11:47:49
【问题描述】:

我的应用有问题。

 render()
 {
  console.log( this.state.ext);
  var tmp = this.state.ext;
  tmp = tmp.toString();
  console.log(tmp);

  if (this.state.ext != ""){

return(
  <View style={styles.container}>
    <Image source={require('../../img/mob.png')} style= {styles.mob_logo}/>
    <WebView
    source={{uri: {tmp}}}  style={{marginTop: 20}}
  />
  </View>
)
}

我得到 JSON 值

{
    tmp = "React Native New Date string"";
}

NSDictionary 类型的不能转换为 NSString。

【问题讨论】:

    标签: javascript ios json reactjs react-native


    【解决方案1】:

    您可以使用 yourDictionary["tmp"] 或 yourDIctionary.Description 将其转换为字符串

    【讨论】:

    • 我不知道该怎么做,你能解释一下吗?
    • 当你得到一个字典时,你可以使用一个键从中取出字符串或对象,或者你可以记录你的字典的描述来查看它的结构
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-09-15
    • 1970-01-01
    • 2011-06-29
    • 1970-01-01
    • 2018-01-15
    • 2017-02-13
    • 2017-04-11
    相关资源
    最近更新 更多