NativeScript / NativeScript/nativescript-cli
Build for iOS fails when Podfile specifies platform 11 or later
Personne n'a encore pris cette issue.
- Langage dominant
- JavaScript
- Étoiles
- 1.1k
- Forks
- 204
- Merge moyen
- 1 j 9 h
- PR mergées (30 j)
- 8
Description
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.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Reproduisez l’échec avec les commandes documentées tns create, nativescript-imagepicker, Podfile platform 11.0 et tns build ios. Examinez l’invocation de xcodebuild de la CLI et le projet généré, ainsi que le Podfile du plugin et App_Resources/iOS/build.xcconfig. Le travail est terminé lorsqu’un build iOS réussit avec un Podfile platform de 11 ou version ultérieure sans nécessiter le workaround.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript
- Domaine
- build-system, cli, mobile-dev
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100