我真的被应用程序插件中的科尔多瓦困住了。
构建iOS应用程序时出现以下错误:
** BUILD FAILED **
The following build commands failed:
CompileC build/roma16.build/Debug-iphonesimulator/roma16.build/Objects-normal/i386/InAppPurchase.o roma16/Plugins/cc.fovea.cord
ova.purchase/InAppPurchase.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
ERROR building one of the platforms: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/patrickhofer/Documents/Apps/roma
16/platforms/ios/cordova/build-debug.xcconfig,-project,roma16.xcodeproj,ARCHS=i386,-target,roma16,-configuration,Debug,-sdk,iphonesimul
ator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/patrickhofer/Documents/Apps/roma16/platforms/ios/build/emulator,SHARED_PRECO
MPS_DIR=/Users/patrickhofer/Documents/Apps/roma16/platforms/ios/build/sharedpch
You may not have the required environment or OS to build this project
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/patrickhofer/Documents/Apps/roma16/platforms/ios/cordova/build
-debug.xcconfig,-project,roma16.xcodeproj,ARCHS=i386,-target,roma16,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CO
NFIGURATION_BUILD_DIR=/Users/patrickhofer/Documents/Apps/roma16/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/patrickhofer/Do
cuments/Apps/roma16/platforms/ios/build/sharedpch
我之前也得到过这个:
In file included from /Users/patrickhofer/Documents/Apps/roma16/platforms/ios/roma16/Plugins/cc.fovea.cordova.purchase/InAppPurchase.m:
9:
/Users/patrickhofer/Documents/Apps/roma16/platforms/ios/roma16/Plugins/cc.fovea.cordova.purchase/InAppPurchase.h:13:9: fatal error: 'Co
rdova/NSData+Base64.h' file not found
#import <Cordova/NSData+Base64.h>
^
1 error generated.
我认为这也很奇怪:
In module 'Foundation' imported from /Users/patrickhofer/Documents/Apps/roma16/platforms/ios/roma16/Plugins/cordova-plugin-globalizatio
n/CDVGlobalization.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Fram
eworks/Foundation.framework/Headers/NSCalendar.h:69:2: note: 'NSMinuteCalendarUnit' has been explicitly marked deprecated here
NSMinuteCalendarUnit NS_CALENDAR_ENUM_DEPRECATED(10_4, 10_10, 2_0, 8_0, "Use NSCalendarUnitMinute instead") = NSCalendarUnitMin
ute,
^
这是我之前所做的:
离子插件添加 cc.fovea.cordova.buy --variable BILLING_KEY="XXX"
我在我的应用程序中添加了逻辑:
var app = angular.module('starter', ['ionic', 'pascalprecht.translate']);
app.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if((window.device && device.platform == "iOS") && window.storekit) {
storekit.init({
debug: true,
ready: onReady,
purchase: onPurchase,
restore: onRestore,
error: onError
});
}
var onReady = function() { }
var onPurchase = function(transactionId, productId, receipt) { }
var onRestore = function(transactionId, productId, transactionReceipt) { }
var onError = function(errorCode, errorMessage) { }
if((window.device && device.platform == "iOS") && window.storekit) {
storekit.init({
debug: true,
ready: function() {
storekit.load(["unlockall"], function (products, invalidIds) {
console.log("In-app purchases are ready to go");
});
},
purchase: function(transactionId, productId, receipt) {
if(productId === 'unlockall') {
console.log("Purchased product id 1");
}
},
restore: function(transactionId, productId, transactionReceipt) {
if(productId === 'unlockall') {
console.log("Restored product id 1 purchase")
}
},
error: function(errorCode, errorMessage) {
console.log("ERROR: " + errorMessage);
}
});
}
if (window.cordova && window.cordova.plugins.Keyboard) {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
// Don't remove this line unless you know what you are doing. It stops the viewport
// from snapping when text inputs are focused. Ionic handles this internally for
// a much nicer keyboard experience.
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
StatusBar.styleDefault();
}
});
});
任何帮助非常感谢!我快疯了...
我也为此
挣扎了很长时间。这个解决方案对我有用:
- 删除您的科尔多瓦插件购买插件
- 重新安装,科尔多瓦插件添加 https://github.com/j3k0/cordova-plugin-purchase.git
https://github.com/j3k0/cordova-plugin-purchase/issues/403