關於Cocos2d-x在IOS中IAP的參考解決方案

本文僅僅作cocos2dx在IOS上實現IAP的解決方案,ios

具體關於IOS中的IAP問題,參考另一篇文章:http://my.oschina.net/u/1432769/blog/314831 spa


在掌握IOS上IAP的教程以後,接下來實現cocos2dx就很是簡單了,,僅僅須要作一箇中間轉換就好了.net

在XCode新建一個C++類,,,實現的那個文件後綴名由.m改爲能夠OC/C++能夠混編的.mm的文件blog

.h文件以下教程

#ifndef __CombiMath24__Bridge_IosIap__get

#define __CombiMath24__Bridge_IosIap__it


#include <iostream>io


class Bridge_IosIap{class

public:import

    void linkToIap();

};


#endif /* defined(__CombiMath24__Bridge_IosIap__) */

.mm文件以下

#include "Bridge_IosIap.h"

#import "IapDelegate.h"


void Bridge_IosIap::linkToIap()

{

    IapDelegate *delegate = [[IapDelegate alloc] init];

    [delegate methodOfShopBtn];

}

這樣就完成了cocosa在IOS上和IOS原生的IAP解決方法的銜接,,,具體在須要的條件下完成IAP只須要調用linkToIap就能夠實現

相關文章
相關標籤/搜索