ios c++ 调用oc代码
今天照猫画虎的用c++调用了一段oc代码,需要注意的一点是为了混编,.cpp文件后缀要改为.mm,其他的就按照oc跟c++语法使用就是了
// // MKStoreForCpp.h // #ifndef SGR_MKStoreForCpp_h #define SGR_MKStoreForCpp_h class MKStoreForCpp { public: inline static MKStoreForCpp& instance() { static MKStoreForCpp mkStoreForCpp; return mkStoreForCpp; } public: void buyFeature(const char* feature); }; #endif
// // MKStoreForCpp.mm // #include "MKStoreForCpp.h" #include "MKStoreManager.h" void MKStoreForCpp::buyFeature(const char* feature) { [[MKStoreManager sharedManager] buyFeature: [NSString stringWithUTF8String: feature]]; }
相关推荐
81731290 2014-03-22
yqmfly 2015-01-23
python大数据 2019-08-27
邓孟鑫 2019-07-19
Jplane 2019-06-30
84334052 2019-06-27
算法的天空 2017-01-11
xingweiyong 2016-03-09
UrbanHooker 2015-01-23
Bigheart 2014-09-22
BenOnceMore 2013-12-30
89283517 2012-10-22
yueluck 2016-05-09
choupiaoyi 2018-06-27
iOSliang 2017-11-15
青峰客 2014-03-10
yunhuaikong 2015-08-09
phyzhou 2015-07-28
弄潮者 2015-07-10