我真的坚持使用应用程序插件中的cordova ..
构建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.purchase - 变量BILLING_KEY =&#34; XXX&#34;
我在我的应用程序中添加了逻辑:
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();
}
});
});
任何帮助非常感谢!我疯了......
答案 0 :(得分:1)
我也在这方面挣扎了很长时间。这个解决方案对我有用: