react-native-audio-streaming icon indicating copy to clipboard operation
react-native-audio-streaming copied to clipboard

undefined is not an object (evaluating 'ReactNativeAudioStreaming.getStatus')

Open jgeurts opened this issue 8 years ago • 23 comments

I'm trying to add the player to the sample app that react creates and am getting an exception when running iOS. I installed react-native-audio-streaming using the cocoapod technique and specified the background audio setting.

My component looks like:

import React, { Component } from 'react';
import {
  StyleSheet,
  Text,
  View
} from 'react-native';
import { Player } from 'react-native-audio-streaming';

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
        <Text style={styles.instructions}>
          To get started, edit index.ios.js
        </Text>
        <Text style={styles.instructions}>
          Press Cmd+R to reload,{'\n'}
          Cmd+D or shake for dev menu
        </Text>
        <Player url={"http://lacavewebradio.chickenkiller.com:8000/stream.mp3"} />
      </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,
  },
});

I'm very new to react-native and ios development, so I could very well be missing something trivial :)

jgeurts avatar Dec 19 '16 03:12 jgeurts

Full code to reproduce this is available at https://github.com/dmbstream/mobile

jgeurts avatar Dec 26 '16 14:12 jgeurts

Hi ! Could you please post also the exception ?

tlenclos avatar Dec 26 '16 14:12 tlenclos

Hopefully this helps - please let me know if I can provide anything else

/Users/jgeurts/dev/meetattheshow_mobile/node_modules/react-native-audio-streaming/ios/ReactNativeAudioStreaming.m:1:9: fatal error: 'RCTBridgeModule.h' file not found
#import "RCTBridgeModule.h"
        ^
1 error generated.



=== BUILD TARGET RCTText OF PROJECT RCTText WITH CONFIGURATION Debug ===

Check dependencies


=== BUILD TARGET RCTSettings OF PROJECT RCTSettings WITH CONFIGURATION Debug ===

Check dependencies

=== BUILD TARGET RCTActionSheet OF PROJECT RCTActionSheet WITH CONFIGURATION Debug ===

Check dependencies

=== BUILD TARGET Pods-MeetAtTheShowTests OF PROJECT Pods WITH CONFIGURATION Debug ===

Check dependencies


** BUILD FAILED **



The following build commands failed:
	CompileC /Users/jgeurts/dev/meetattheshow_mobile/ios/build/Build/Intermediates/Pods.build/Debug-iphonesimulator/RNAudioStreaming.build/Objects-normal/x86_64/ReactNativeAudioStreaming.o /Users/jgeurts/dev/meetattheshow_mobile/node_modules/react-native-audio-streaming/ios/ReactNativeAudioStreaming.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

jgeurts avatar Dec 26 '16 15:12 jgeurts

Weird, did you try the manual installation process ? https://github.com/tlenclos/react-native-audio-streaming#3-manual-installation

tlenclos avatar Dec 26 '16 15:12 tlenclos

I think It has to do with the JavaScript version

devvpm avatar Dec 26 '16 16:12 devvpm

@jgeurts try this react-native link react-native-audio-streaming

and then react-native run-android

devvpm avatar Dec 27 '16 15:12 devvpm

@devvpm The link command completed successfully, but I'm getting the following now:

** BUILD FAILED **


The following build commands failed:

	CompileC /Users/jgeurts/dev/meetattheshow_mobile/ios/build/Build/Intermediates/Pods.build/Debug-iphonesimulator/RNAudioStreaming.build/Objects-normal/x86_64/ReactNativeAudioStreaming.o /Users/jgeurts/dev/meetattheshow_mobile/node_modules/react-native-audio-streaming/ios/ReactNativeAudioStreaming.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

If it makes a difference, I'm using node v6.6.0. Also, I'm not sure if it matters, but when I modified the Podfile for the iOS project, I linked to node_modules as: pod 'RNAudioStreaming', :path => '../node_modules/react-native-audio-streaming' - Notice the .. before node_modules.

jgeurts avatar Dec 27 '16 17:12 jgeurts

@jgeurts That worked for me in Android, Check this link for iOS. Linking Libraries - iOS

devvpm avatar Jan 01 '17 11:01 devvpm

Hi,

i wonder i have a similar issue. Indeed when i try to use ReactNativeAudioStreaming in this case:

> let songsDataSource = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }).cloneWithRows( this.props.artist.songs );
> return(
>                 <ListView
>                     dataSource={ songsDataSource }
>                     style={ styles.songsList }
>                     renderHeader={this.renderHeaderSongList.bind(this)}
>                     renderRow={(song, sectionId, rowId) => (
>                   <TouchableHighlight onPress={ () => {
>                       this.setState({selectedSource: song.url});
>                       {ReactNativeAudioStreaming.play(song.url, {})}
>                   }}>
>                     <View key={song} style={ styles.song }>
>                       <Text style={ styles.songTitle }>
>                         { song.url }
>                       </Text>
>                       <Text style={ styles.albumTitle }>
>                         { song.album }
>                       </Text>
>                     </View>
>                   </TouchableHighlight>
>                  )}
>                 />
>             );
> 

i have the same problem with : undefined is not an object (evaluating '_reactNativeAudioStreaming.ReactNativeAudioStreaming.play')

I installed it with react native link and i followed all the instructions. Note: The link libraries that i have are: libStreamingKit.a and libPods-ReactNativeAudioStreaming.a (not libReactNativeAudioStreaming.a ). Could it be a problem?

piloulac avatar Jan 08 '17 21:01 piloulac

same problem: BUILD SUCCEEDED in console but : undefined is not an object (evaluating '_reactNativeAudioStreaming.ReactNativeAudioStreaming.play')

amirrezamahyari avatar Jan 10 '17 15:01 amirrezamahyari

use the manual way (3rd option) to solve this

zerbfra avatar Jan 14 '17 13:01 zerbfra

@zerbfra Nothing changed. Still getting the same error. Tried all ways of installation

gaggi4734 avatar Mar 10 '17 05:03 gaggi4734

any updates on this? i'm getting the same error

ryanvoong avatar May 23 '17 04:05 ryanvoong

I´m having the same issue on Android "react-native": "0.45.1",

oximer avatar Jun 30 '17 13:06 oximer

The example project works. What else is different in the setup? (I'm having trouble with android)

nikolaigeorgie avatar Jul 01 '17 22:07 nikolaigeorgie

I used the 2nd method for IOS and got this error too, and it was because I was unable to add lib-ReactNativeAudioStreaming.a ( I only had the option for libPods-ReactNativeAudioStreaming under Link Binary with Libraries) and I found that I needed to add ReactNativeAudioStreaming.xcodeproj under Libraries in order to have the correct option. Once I did that it ran just fine.

tb9jen avatar Jul 19 '17 16:07 tb9jen

@tb9jen Hey, this worked for me. So, thanks. I think many folks here are getting stuck up with the libPods-ReactNativeAudioStreaming vs lib-ReactNativeAudioStreaming.

FYI - I used install option #2.

thngdude avatar Aug 26 '17 01:08 thngdude

Hi, the same thing for me, someone solved this ?

zaouifahd avatar Sep 05 '17 11:09 zaouifahd

Same issue

twisstosin avatar Oct 04 '17 21:10 twisstosin

@tb9jen you saved me :) Dragging ReactNativeAudioStreaming.xcodeproj inside project did the trick. Thanks!

polp6880 avatar Oct 13 '17 22:10 polp6880

Tried all installation types and I still get same error fatal error: 'React/RCTBridgeModule.h' file not found #import <React/RCTBridgeModule.h>

kostyaVyrodov avatar Oct 25 '17 15:10 kostyaVyrodov

I have the same issue ../native/React/Base/RCTBridgeModule.h:54:16: Redefinition of 'RCTMethodInfo'

arcesoj avatar Oct 26 '17 04:10 arcesoj

@kostyaVyrodov @JoseArceDev - to solve that issue I had to use an older version of React Native. This is what I have in my package.json for the test I did:

"react-native": "0.47.2"

polp6880 avatar Oct 29 '17 07:10 polp6880