This commit is contained in:
DerekChia jingqiang.jia@hand-china.com 2017-06-23 14:31:46 +08:00
parent e20a10588f
commit 4bc2fe3dc1
2 changed files with 83 additions and 73 deletions

View File

@ -6,6 +6,7 @@ const fs = require('fs');
const path = require('path'); const path = require('path');
module.exports.addAPNSinEntitlements = (entitlementPath, isProduction) => { module.exports.addAPNSinEntitlements = (entitlementPath, isProduction) => {
if( fs.existsSync(entitlementPath) ) {
fs.readFile(entitlementPath, "utf8", function(err, data) { fs.readFile(entitlementPath, "utf8", function(err, data) {
if (err) { if (err) {
throw err; throw err;
@ -41,9 +42,13 @@ module.exports.addAPNSinEntitlements = (entitlementPath, isProduction) => {
console.log(entitlementPath + " written successfully"); console.log(entitlementPath + " written successfully");
}); });
}); });
} else {
console.log("Entitlement File '" + entitlementPath + "' not found. Make sure your ios platform upper than 4.3.0");
}
} }
module.exports.removeAPNSinEntitlements = (entitlementPath) => { module.exports.removeAPNSinEntitlements = (entitlementPath) => {
if( fs.existsSync(entitlementPath) ) {
fs.readFile(entitlementPath, "utf8", function(err, data) { fs.readFile(entitlementPath, "utf8", function(err, data) {
if (err) { if (err) {
throw err; throw err;
@ -66,6 +71,9 @@ module.exports.removeAPNSinEntitlements = (entitlementPath) => {
console.log(entitlementPath + " written successfully"); console.log(entitlementPath + " written successfully");
}); });
}); });
} else {
console.log("Entitlement File '" + entitlementPath + "' not found. Make sure your ios platform upper than 4.3.0");
}
} }
module.exports.getXcodeProjName = (searchPath) => { module.exports.getXcodeProjName = (searchPath) => {

View File

@ -139,6 +139,7 @@ let enablePushNotificationForXCode = (entitlementsPath, pbxprojPath, cordovaBuil
}); });
} }
module.exports = (context) => {
let basePath = './platforms/ios/'; let basePath = './platforms/ios/';
let buildType = 'dev'; let buildType = 'dev';
let xcodeprojName = commonFuncs.getXcodeProjName(basePath); let xcodeprojName = commonFuncs.getXcodeProjName(basePath);
@ -165,3 +166,4 @@ enablePushNotificationForCI(basePath, xcodeprojName);
if(willEnablePushNotificationForXCode) { if(willEnablePushNotificationForXCode) {
enablePushNotificationForXCode(entitlementsPath, pbxprojPath, cordovaBuildConfig); enablePushNotificationForXCode(entitlementsPath, pbxprojPath, cordovaBuildConfig);
} }
}