Realm的网桥没有二传手或ivar,这是不允许的

时间:2019-01-03 18:33:26

标签: ios react-native jitsi-meet realm-js

我想在Realm中使用Jitsi-Meet(视频通话库)。当我在iOS上运行该应用程序时,Realm无法正常工作。它显示以下错误:

2018-12-28 16:22:34.504 [error][tid:main][RCTModuleData.mm:179] Realm has no setter or ivar for its bridge, which is not permitted. You must either @synthesize the bridge property, or provide your own setter method.

如果我删除Jisti-Meet Library,则Realm可以正常工作。而且Jitsi-Meet也可以在没有领域的情况下正常运行。

复制步骤

  1. 创建一个新的本机应用程序:react-native init AwesomeProject
  2. 安装realm-js:npm install realm --savereact-native link realm
  3. 安装React Native Jisti Meet:npm install react-native-jitsi-meet --save
  4. 在Build设置下,将死代码剥离设置为No,将 Enable Bitcode 设置为No,并将始终嵌入Swift标准库设置为Yes
  5. node_modules/react-native-jitsi-meet/ios/WebRTC.frameworknode_modules/react-native-jitsi-meet/ios/JitsiMeet.framework添加到Embed Binaries。
  6. 选择Build Settings,找到Search Paths。编辑Framework Search PathsLibrary Search Paths。并使用$(SRCROOT)/../node_modules/react-native-jitsi-meet/iosrecursive
  7. 在两个部分上添加路径

现在运行该应用程序,该应用程序将显示错误。

代码示例

文件名:App.js

import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View, Button} from 'react-native';
import Realm from 'realm';

const instructions = Platform.select({
  ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
  android:
    'Double tap R on your keyboard to reload,\n' +
    'Shake or press menu button for dev menu',
});


type Props = {};
export default class App extends Component<Props> {

  constructor(props) {
    super(props);
    this.state = { realm: null };
  }


  componentWillMount() {
    Realm.open({
      schema: [{name: 'Dog', properties: {name: 'string'}}]
    }).then(realm => {
      realm.write(() => {
        realm.create('Dog', {name: 'Rex'});
      });
      this.setState({ realm });
    });
  }

  render() {

    const info = this.state.realm
    ? 'Number of dogs in this Realm: ' + this.state.realm.objects('Dog').length
    : 'Loading...';


    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>Welcome to React Native!</Text>
        <Text style={styles.instructions}>To get started, edit App.js</Text>
        <Text style={styles.instructions}>{instructions}</Text>
        <Button title="Video" 
        // onPress = {() => initiateVideoCall()} 
        />
        <Text style={styles.welcome}>
          {info}
        </Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

领域和工具版本

  • Realm JS SDK版本:2.21.1(较低的版本也有相同的问题)
  • 节点或React Native:RN 0.57.8
  • 客户端操作系统和版本:iOS Real Device-12.1.2
  • MacOS:10.13.6 High Sierra
  • React Native的哪个调试器:无

0 个答案:

没有答案