javascript - Json值NSDictionary转换

标签 javascript ios json reactjs react-native

我的应用程序有问题。

 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。

最佳答案

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

关于javascript - Json值NSDictionary转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41612012/

相关文章:

javascript - Fullcalendar Scheduler Timeline View - 查找外部拖放事件的资源 ID

javascript - setTimeout 只运行一次?

javascript - 在 SPRING MVC 和 JSP 环境中使用 jquery 和 ajax 呈现表的复选框

ios - 键盘向上移动时如何固定UIView的位置?

java - JSON - 使用 jackson 库解析无效的终止字符串

javascript - 在 CasperJS 的 XPath 表达式中使用 contains(text(), "string") 时如何使用忽略大小写?

ios - 尝试获取 UITableViewCell 的 indexPath 时出现错误

ios - 动画DidStop : finished: delegate method not getting called

java - 更有效地解析 json?

c# - 将 JSON 反序列化为 C# 对象以在网格中将嵌套数组显示为字符串