apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.16k stars 988 forks source link

Cannot use `cordova platform add ios` on windows - xcode error 66 is returned during the subsequent cordova build on macOS #971

Closed stevenmldn closed 1 year ago

stevenmldn commented 4 years ago

Bug Report

Cannot use cordova platform add ios on windows

Problem

Added an ios platform on a windows box results in the file containing the wrong slash type, backslashes rather than forward-slashes.

What is expected to happen

Adding the platform on macOS includes the following line the the xcode project file 301BF52D109A57CC0062928A / CordovaLib/CordovaLib.xcodeproj / = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CordovaLib.xcodeproj; path = CordovaLib/CordovaLib.xcodeproj; sourceTree = ""; };

Notice the slash in the path

What does actually happen?

Adding the platform on windows includes the following line the the xcode project file 301BF52D109A57CC0062928A / CordovaLib/CordovaLib.xcodeproj / = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CordovaLib.xcodeproj; path = CordovaLib\CordovaLib.xcodeproj; sourceTree = ""; };

Notice the slash in the path

The project fails to open in xcode. The following error is returned when attempting to build via corodva-cli stderr: '2020-08-20 14:22:02.768 xcodebuild[32234:997204] CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary on line 75. Parsing will be abandoned. Break on _CFPropertyListMissingSemicolon to debug.\n2020-08-20 14:22:02.768 xcodebuild[32234:997204] Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}\n2020-08-20 14:22:02.768 xcodebuild[32234:997204] [MT] IDEFileReferenceDebug: [Load] <IDEFileReference, 0x7fad238295e0: name:xxx path:group:xxx.xcodeproj> Failed to load container at path: /Mobile/platforms/ios/xxxxxx.xcodeproj, Error: Error Domain=Xcode3ProjectErrorDomain Code=2 "The project ‘xxx’ is damaged and cannot be opened due to a parse error. Examine the project file for invalid edits or unresolved source control conflicts.\n\nPath: Mobile/platforms/ios/xxxxxx.xcodeproj" UserInfo={NSLocalizedDescription=The project ‘xxx’ is damaged and cannot be opened due to a parse error. Examine the project file for invalid edits or unresolved source control conflicts.\n\nPath: /Mobile/platforms/ios/xxx.xcodeproj}\n--- xcodebuild: WARNING: Unable to open project file \'/Mobile/platforms/ios/xxx.xcodeproj\' in workspace \'xxx.xcworkspace\'.\n2020-08-20 14:22:02.862 xcodebuild[32234:997374] DVTProvisioningProfileManager: Failed to load profile "///Library/MobileDevice/Provisioning Profiles/Old" (Error Domain=DVTProvisioningProfileSourceErrorDomain Code=0 "No provisioning profile provider found for profile "///Library/MobileDevice/Provisioning Profiles/Old"." UserInfo={NSLocalizedDescription=No provisioning profile provider found for profile "///Library/MobileDevice/Provisioning Profiles/Old".})\n2020-08-20 14:22:03.021 xcodebuild[32234:997377] CFURLRequestSetHTTPCookieStorageAcceptPolicy_block_invoke: no longer implemented and should not be called\nxcodebuild: error: Scheme xxx is not currently configured for the archive action.\n\nxcodebuild: Command failed with exit code 66\n' }

Command or Code

cordova platform add ios on Windows cordova build ios on macOS

Environment, Platform, Device

Adding the ios platform on Windows 10, copying to a mac and building there

Version information

on both the windows and macOS boxes, we are using Cordova - v10

Checklist

breautek commented 4 years ago

iOS platform and commands are only supported on Macs, as documented here

However, I think maybe the CLI should actually tell you that if you try to use cordova platform add ios in an unsupported environment.

copying to a mac and building there

It's also not recommended to copy platforms/ directories in between environments. The same for the plugins/ directory. These two directories should be ignored in your version control system.

Instead, you can clone your project on the mac environment, then use cordova platform add ios to add the ios project. This will also download all the plugins and node_modules required by the ios project & their plugins, some of which may have native binaries that wouldn't be installed correctly if you just simply copied your entire project over.

Hope this helps to not only point out the "what", but also the "why" what you're attempting to do won't work.

However, I think maybe the CLI should actually tell you that if you try to use cordova platform add ios in an unsupported environment.

For this reason, I'll leave the ticket open.

AdamLak commented 3 years ago

You can run cordova prepare ios on any platform, but build only runs on macOs. You need Xcode to build your prepared iOS project.

Just transfer the platform/ios folder to your macbook and run the pod install --repo-update, then build with Xcode.

https://github.com/apache/cordova-ios/pull/1018