sbugert / react-native-admob

A react-native component for Google AdMob banners
BSD 2-Clause "Simplified" License
1.13k stars 531 forks source link

Google Ads Manager ads not showing. #447

Closed shubh261994 closed 5 years ago

shubh261994 commented 5 years ago

I have been trying to get the DFP ads to work on iOS with:

<PublisherBanner
          adSize={'banner'}
          adUnitID={'/6499/example/banner'}
          testDevices={[PublisherBanner.simulatorId]}
          onAdFailedToLoad={error => console.log(error)}
          onAppEvent={event => console.log(event.name, event.info)}
          onSizeChange={this.onSizeChange}
        />

This works good on Android but I get the following error in ios:

Error: Request Error: Invalid request.
    at createErrorFromErrorData (utils.js:6)
    at PublisherBanner.handleAdFailedToLoad (RNPublisherBanner.js:53)
    at PublisherBanner.proxiedMethod (createPrototypeProxy.js:44)
    at Object.invokeGuardedCallbackImpl (ReactNativeRenderer-dev.js:93)
    at invokeGuardedCallback (ReactNativeRenderer-dev.js:318)
    at invokeGuardedCallbackAndCatchFirstError (ReactNativeRenderer-dev.js:342)
    at executeDispatch (ReactNativeRenderer-dev.js:715)
    at executeDispatchesInOrder (ReactNativeRenderer-dev.js:737)
    at executeDispatchesAndRelease (ReactNativeRenderer-dev.js:894)
    at executeDispatchesAndReleaseTopLevel (ReactNativeRenderer-dev.js:902)

Can anyone tell what's the issue here?

gunduzcihat commented 5 years ago

+1 same happened

shubh261994 commented 5 years ago

It ran for me by using the following:

 <View>
                 <PublisherBanner
                    style={{ height: 50, width: 320, backgroundColor: 'green' }}
                    adSize="banner"
                    validAdSizes={['banner', 'smartBannerPortrait', 'largeBanner', 'mediumRectangle']}                   
                    adUnitID='/6499/example/banner' 
                    testDevices={[PublisherBanner.simulatorId]}
                    didFailToReceiveAdWithError={(e) => console.log('Banner:onAdFailedToLoad', e)}
                    onAdLoaded={() => console.log('Banner:onAdLoaded')}
                    onAdFailedToLoad={(e) => console.log('Banner:onAdFailedToLoad', e)}
                    onAdOpened={() => console.log('Banner:onAdOpened')}
                    onAdClosed={() => console.log('Banner:onAdClosed')}
                    onAdLeftApplication={() => console.log('Banner:onAdLeftApplication')}
                    onAppEvent={(event) => console.log('Banner:onAppEvent', event)}
                />
            </View>
luatnd commented 4 years ago

Mee too, Add style made it work! Strange!