NativeScript / NativeScript/nativescript-cli
Build for iOS fails when Podfile specifies platform 11 or later
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 1.1k
- Forks
- 204
- Ø Merge
- 1 T. 9 Std.
- Gemergte PRs (30 T.)
- 8
Beschreibung
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
- CLI: 5.1.1
- Cross-platform modules: Not applicable
- Android Runtime: Not applicable
- iOS Runtime: Not applicable
- Plugin(s): Any plugin with Podfile will do the job. For this report I've used
nativescript-imagepicker.
Describe the bug
When the platform in Podfile is 11 or later, build for iOS fails with error:
ld: warning: directory not found for option '-F<path to project>/platforms/ios/build/Debug-iphonesimulator/QBImagePickerController'
ld: framework not found QBImagePickerController
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build systemnote: Planning buildnote: Constructing build description
To Reproduce
- Create new project:
$ tns create myApp --js - Navigate to project:
$ cd myApp - Add
nativescript-imagepickerplugin:npm i --save --save-exact nativescript-imagepicker - Open the Podfile in
nativescript-imagepicker:code node_modules/nativescript-imagepicker/platforms/ios/Podfileand add the following line at the top:
platform :ios, '11.0'
- Now build for iOS:
tns build iosortns build ios --forDevice
The build will fail.
Expected behavior
The build should succeed.
Additional context
It looks like the problem is in the Pods - the specified platform is used only for building the framework, but not for the actual Pod target and the application. When building for iOS 11 or later, Xcode automatically builds for 64bits only, i.e. for arm64 (for device) or x86_64 (for simulator).
When CLI tries to build the project, it spawns xcodebuild with ONLY_ACTIVE_ARCH=NO, i.e. Xcode will build the project for all architectures based on the deployment target. As the default deployment target is 9, Xcode will build for both armv7 and arm64 (for device) or i386 and x86_64 (for simulator). As the Pods project has platform "11.0", the static framework will be build only for the 64bits arch, so the actual build of the project will not be able to find the framework for armv7/i386 and it fails.
Workarounds
- Delete the platform: ios, '11.0' line from all plugins that add it.
or - Specify
IPHONEOS_DEPLOYMENT_TARGET = 11.0in your<path to project's App_Resources>/iOS/build.xcconfig- this way when Xcode builds your project, it will build only for 64bits architecture and the build will succeed. NOTE: This way your app will not work on lower iOS targets.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere den Fehler mit den dokumentierten Befehlen tns create, nativescript-imagepicker, Podfile platform 11.0 und tns build ios. Untersuche den xcodebuild-Aufruf der CLI und das generierte Projekt zusammen mit dem Plugin-Podfile und App_Resources/iOS/build.xcconfig. Als erledigt gilt die Aufgabe, wenn ein iOS-Build mit einem Podfile platform von 11 oder höher erfolgreich ist, ohne dass der Workaround erforderlich ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- build-system, cli, mobile-dev
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100