Skip to content

Commit a37f3e3

Browse files
Merge pull request #1692 from NativeScript/vladimirov/fix-cocoapods
Fix build for iOS
2 parents 9202b9a + 1c2d617 commit a37f3e3

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

lib/services/ios-project-service.ts

+9-15
Original file line numberDiff line numberDiff line change
@@ -204,26 +204,13 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
204204

205205
args = args.concat((buildConfig && buildConfig.architectures) || defaultArchitectures);
206206
} else {
207-
let currentSimulator = this.$iOSSimResolver.iOSSim.getRunningSimulator();
208207
args = basicArgs.concat([
209208
"-sdk", "iphonesimulator",
209+
"-arch", "i386",
210+
'VALID_ARCHS="i386"',
210211
"CONFIGURATION_BUILD_DIR=" + path.join(projectRoot, "build", "emulator"),
211212
"CODE_SIGN_IDENTITY="
212213
]);
213-
214-
let additionalArgs: string[] = [],
215-
xcodeVersion = this.$xcodeSelectService.getXcodeVersion().wait();
216-
217-
xcodeVersion.patch = xcodeVersion.patch || "0";
218-
// passing -destination apparently only works with Xcode 7.2+
219-
if (xcodeVersion.major && xcodeVersion.minor &&
220-
helpers.versionCompare(xcodeVersion, "7.2.0") < 0) {
221-
additionalArgs = ["-arch", "i386", 'VALID_ARCHS="i386"'];
222-
} else {
223-
additionalArgs = ["-destination", `platform=iOS Simulator,name=${this.$iOSSimResolver.iOSSim.getSimulatorName(currentSimulator && currentSimulator.name)}`];
224-
}
225-
226-
args = args.concat(additionalArgs);
227214
}
228215

229216
if (buildConfig && buildConfig.codeSignIdentity) {
@@ -677,6 +664,13 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
677664
let cocoapodsVer = this.$sysInfo.getSysInfo(this.$staticConfig.pathToPackageJson).wait().cocoapodVer,
678665
xcodeVersion = this.$xcodeSelectService.getXcodeVersion().wait();
679666

667+
if(!semver.valid(cocoapodsVer)) {
668+
// Cocoapods betas have names like 1.0.0.beta.8
669+
// These 1.0.0 betas are not valid semver versions, but they are working fine with XCode 7.3
670+
// So get only the major.minor.patch version and consider them as 1.0.0
671+
cocoapodsVer = _.take(cocoapodsVer.split("."), 3).join(".");
672+
}
673+
680674
xcodeVersion.patch = xcodeVersion.patch || "0";
681675
let shouldUseXcproj = semver.lt(cocoapodsVer, "1.0.0") && ~helpers.versionCompare(xcodeVersion, "7.3.0");
682676

0 commit comments

Comments
 (0)