Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AdMob奖励视频加载在IOS上失败 我试图通过C++控制AdMB奖励视频广告,因为我在iOS上从事COCOS2D-X项目,遵循本教程。->但是,当尝试通过LoadAd()请求ad时,同样的错误会不断发生。“HTTP加载失败(错误代码:-999)” 我尝试了在基本COCOS2D X项目上,以确保如何通过C++代码来控制视频,而不是使用java或Obj-C或SWIFT。我尝试了横幅广告和插播广告,并取得了成功,但效果很好,只有奖励视频失败。我是否必须分别在Android上使用JAVA和在IOS上使用Obj-C控制AdMob奖励视频广告?或者,有没有其他方法可以让广告像横幅广告和插页广告一样成功?请告诉我一些如何度过难关的想法。。下面是我项目的全部代码 AppDelegate.h AppDelegate.cpp 包括.h HelloWorld场景 HelloWorldScene.cpp_Android_Ios_Admob_Cocos2d X_Rewardedvideoad - Fatal编程技术网

AdMob奖励视频加载在IOS上失败 我试图通过C++控制AdMB奖励视频广告,因为我在iOS上从事COCOS2D-X项目,遵循本教程。->但是,当尝试通过LoadAd()请求ad时,同样的错误会不断发生。“HTTP加载失败(错误代码:-999)” 我尝试了在基本COCOS2D X项目上,以确保如何通过C++代码来控制视频,而不是使用java或Obj-C或SWIFT。我尝试了横幅广告和插播广告,并取得了成功,但效果很好,只有奖励视频失败。我是否必须分别在Android上使用JAVA和在IOS上使用Obj-C控制AdMob奖励视频广告?或者,有没有其他方法可以让广告像横幅广告和插页广告一样成功?请告诉我一些如何度过难关的想法。。下面是我项目的全部代码 AppDelegate.h AppDelegate.cpp 包括.h HelloWorld场景 HelloWorldScene.cpp

AdMob奖励视频加载在IOS上失败 我试图通过C++控制AdMB奖励视频广告,因为我在iOS上从事COCOS2D-X项目,遵循本教程。->但是,当尝试通过LoadAd()请求ad时,同样的错误会不断发生。“HTTP加载失败(错误代码:-999)” 我尝试了在基本COCOS2D X项目上,以确保如何通过C++代码来控制视频,而不是使用java或Obj-C或SWIFT。我尝试了横幅广告和插播广告,并取得了成功,但效果很好,只有奖励视频失败。我是否必须分别在Android上使用JAVA和在IOS上使用Obj-C控制AdMob奖励视频广告?或者,有没有其他方法可以让广告像横幅广告和插页广告一样成功?请告诉我一些如何度过难关的想法。。下面是我项目的全部代码 AppDelegate.h AppDelegate.cpp 包括.h HelloWorld场景 HelloWorldScene.cpp,android,ios,admob,cocos2d-x,rewardedvideoad,Android,Ios,Admob,Cocos2d X,Rewardedvideoad,我在ATS上启用了以下附加功能-> 但是仍然出现错误“HTTP加载失败(错误代码:-999)”。是否已将NSAllowsArbitraryLoads设置为“是”?是否在生成设置中设置NSAllowsArbitraryLoads。。。?我搜索了info.plist,但没有找到任何地方。我刚搜索完,但仍然看到相同的错误如果(firebase::admob::Pawarded\u video::LoadAdLastResult().status()==firebase::kFutureStatusCo

我在ATS上启用了以下附加功能->
但是仍然出现错误“HTTP加载失败(错误代码:-999)”。

是否已将NSAllowsArbitraryLoads设置为“是”?是否在生成设置中设置NSAllowsArbitraryLoads。。。?我搜索了info.plist,但没有找到任何地方。我刚搜索完,但仍然看到相同的错误如果(firebase::admob::Pawarded\u video::LoadAdLastResult().status()==firebase::kFutureStatusComplete&&firebase::admob::Pawarded\u video::LoadAdLastResult().error()==firebase::admob::KadMoberOne){//my_ad_parent是对iOS UIView或Android活动的引用//这是奖励视频的父UIView或活动。firebase::admob::奖励视频::Show(my_ad_parent);}
#ifndef  _APP_DELEGATE_H_
#define  _APP_DELEGATE_H_

#include "cocos2d.h"
#include "Includes.h"

class  AppDelegate : private cocos2d::Application
{
public:
    AppDelegate();
    virtual ~AppDelegate();

    virtual void initGLContextAttrs();
    virtual bool applicationDidFinishLaunching();

    ...
};

#endif
#include "AppDelegate.h"
#include "HelloWorldScene.h"

bool AppDelegate::applicationDidFinishLaunching() {

    ...

    // Firebase Initialize
    firebase::App* app = firebase::App::Create(firebase::AppOptions());
    // AdMob Initialize with Test App ID
    firebase::admob::Initialize(*app, "ca-app-pub-3940256099942544~1458002511");

    auto scene = HelloWorld::createScene();
    director->runWithScene(scene);

    return true;
}
#ifndef _Includes_h_
#define _Includes_h_

#include "firebase/app.h"
#include "firebase/admob.h"
#include "firebase/admob/types.h"
#include "firebase/future.h"

#include "firebase/admob/rewarded_video.h"

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include <jni.h>
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
extern "C" {
#include <objc/objc.h>
}  // extern "C"
#endif

// Returns a variable that describes the ad parent for the app. On Android
// this will be a JObject pointing to the Activity. On iOS, it's an ID pointing
// to the root view of the view controller.
firebase::admob::AdParent getAdParent();

#endif
#include "Includes.h"

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include "platform/android/jni/JniHelper.h"
#endif

USING_NS_CC;

firebase::admob::AdParent getAdParent() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    // Returns the iOS RootViewController's main view (i.e. the EAGLView).
    return (id)Director::getInstance()->getOpenGLView()->getEAGLView();
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    // Returns the Android Activity.
    return JniHelper::getActivity();
#else
    // A void* for any other environments.
    return 0;
#endif
}
#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__

#include "cocos2d.h"
#include "ui/CocosGUI.h"

#include "Includes.h"

class HelloWorld : public cocos2d::Scene
{
public:
    static cocos2d::Scene* createScene();
    CREATE_FUNC(HelloWorld);
    virtual bool init();

    cocos2d::ui::Button* btn01;
    void BtnTest();

    firebase::admob::AdRequest ad_request = {};
};

#endif
#include "HelloWorldScene.h"

USING_NS_CC;

Scene* HelloWorld::createScene()
{
    return HelloWorld::create();
}

bool HelloWorld::init()
{
    if ( !Scene::init() )
        return false;

    auto pos = this->getContentSize();

    btn01 = ui::Button::create("HelloWorld.png");
    btn01->addClickEventListener(CC_CALLBACK_0(HelloWorld::BtnTest, this));
    btn01->setPosition(Point(pos.width / 2, pos.height / 2));
    this->addChild(btn01);

    firebase::admob::rewarded_video::Initialize();
    // Error occurs on LoadAd(), and below is Test Unit Id on IOS.
    firebase::admob::rewarded_video::LoadAd("ca-app-pub-3940256099942544/1712485313", ad_request);

    return true;
}

void HelloWorld::BtnTest()
{
    firebase::admob::rewarded_video::Show(getAdParent());
}