add: check does com.apple.Push attribute exist in .pbxproj to avoid not found error.

This commit is contained in:
DerekChia jingqiang.jia@hand-china.com 2017-06-29 15:15:12 +08:00
parent 6059f546f6
commit 7b70564f82

View File

@ -41,15 +41,17 @@ let disablePushNotificationForXCode = (entitlementsPath, pbxprojPath) => {
// turn off Push Notification Capability
let re4rep = new RegExp('isa = PBXProject;(.|[\r\n])*TargetAttributes(.|[\r\n])*SystemCapabilities(.|[\r\n])*com\.apple\.Push = {(.|[\r\n])*enabled = [01]');
let parts = re4rep.exec(data);
result = data.replace(re4rep, parts[0].substr(0, parts[0].length - 1) + '0');
if(parts !== null && parts !== undefined && parts.length > 0) {
result = data.replace(re4rep, parts[0].substr(0, parts[0].length - 1) + '0');
// write result to project.pbxproj
fs.writeFile(pbxprojPath, result, {"encoding": 'utf8'}, function(err) {
if (err) {
throw err;
}
console.log(pbxprojPath + " written successfully");
});
// write result to project.pbxproj
fs.writeFile(pbxprojPath, result, {"encoding": 'utf8'}, function(err) {
if (err) {
throw err;
}
console.log(pbxprojPath + " written successfully");
});
}
});
}