Swift 5 test build fails with missing Provisioning Profile error - swift

I am trying to build my iOS app from the command line using this command :
$ CODE_SIGNING_ALLOWED=NO xcodebuild -target 'MyApp' -sdk iphoneos -configuration Release
But it fails with the following error :
note: Using new build system
note: Planning build
note: Constructing build description
error: "MyApp" requires a provisioning profile. Select a provisioning profile in the Signing & Capabilities editor. (in target 'MyApp' from project 'MyProject')
Im not interested in signing my app at all. I just want to be able to build from the command line.
Is anyone aware what I am doing wrong?
BTW, I have NOT downloaded any provisioning profile from Apple but Xcode is able to build and run the app. Why is that?

Related

No Provisioning Profile when flutter run --use-application-binary

To check built my ipa(iOS) binary using flutter build ipa in CLI.
flutter build ipa and then flutter run --use-application-binary
Below are the result outputs.
$ flutter run --use-application-binary=build/ios/ipa/xxx.ipa
Launching lib/main.dart on Jisang-iPhone in debug mode...
════════════════════════════════════════════════════════════════════════════════
No Provisioning Profile was found for your project's Bundle Identifier or your
device. You can create a new Provisioning Profile for your project in Xcode for
your team by:
1- Open the Flutter project's Xcode target with
open ios/Runner.xcworkspace
2- Select the 'Runner' project in the navigator then the 'Runner' target
in the project settings
3- Make sure a 'Development Team' is selected under Signing & Capabilities > Team.
You may need to:
- Log in with your Apple ID in Xcode first
- Ensure you have a valid unique Bundle ID
- Register your device with your Apple Developer Account
- Let Xcode automatically provision a profile for your app
4- Build or run your project again
It's also possible that a previously installed app with the same Bundle
Identifier was signed with a different certificate.
For more information, please visit:
https://flutter.dev/docs/get-started/install/macos#deploy-to-ios-devices
Or run on an iOS simulator without code signing
════════════════════════════════════════════════════════════════════════════════
Could not run /var/folders/b1/r6ygmnb533xb5qlcjvpwhpz00000gn/T/flutter_tools.3nBcWf/flutter_app.EW5AEN/Payload/Runner.app on 55b673a0051bff5da6647855674d358aa0f62f8b.
Try launching Xcode and selecting "Product > Run" to fix the problem:
open ios/Runner.xcworkspace
Installing and launching... 20.8s
Error launching application on xxx-iPhone.
Is there any option build binary to use application bianry in flutter ?
flutter run --use-application-binary

Cannot get Ionic 5 to deploy to physical device: Command PhaseScriptExecution failed

I am trying to deploy an Ionic 5 project to an iPhone 12 running iOS 14.6 with XCode 11.4. The app runs fine on the emulator but after following the official instructions here I get Command PhaseScriptExecution failed error and in the logs directly before that is this error:
Code Signing /Users/simonhill/Library/Developer/Xcode/DerivedData/App-buuhfmnvjxqcivakwsfsgrdpsrjw/Build/Products/Debug-iphoneos/App.app/Frameworks/Capacitor.framework with Identity Apple Development: xxx#gmail.com (7FSK2UE87Y)
/usr/bin/codesign --force --sign 7B0B8B04EB8EB60F0EB9540253FEC8FB09E379AC --preserve-metadata=identifier,entitlements '/Users/simonhill/Library/Developer/Xcode/DerivedData/App-buuhfmnvjxqcivakwsfsgrdpsrjw/Build/Products/Debug-iphoneos/App.app/Frameworks/Capacitor.framework'
Warning: unable to build chain to self-signed root for signer "Apple Development: simonhill303#gmail.com (7FSK2UE87Y)"
/Users/simonhill/Library/Developer/Xcode/DerivedData/App-buuhfmnvjxqcivakwsfsgrdpsrjw/Build/Products/Debug-iphoneos/App.app/Frameworks/Capacitor.framework: errSecInternalComponent
I followed the instructions to create my Apple cert and don't understand how to fix this error. I tried this answer Error Xcode 10 . PhaseScriptExecution failed with a nonzero exit code: errSecInternalComponent but could not get it to work.
UPDATE
It may be this problem https://developer.apple.com/support/expiration/:
Known Issues Xcode 11.4.0 and earlier may not be able to sign software
using signing certificates issued by the new Apple Worldwide Developer
Relations Certification Intermediate Certificate. If you’re unable to
upgrade to a supporting version of macOS or Xcode on your build
machine, you can build and archive your app using an earlier Xcode
client and sign it for distribution using the latest release.
Alternatively, you can utilize the codesign tool to sign your software
using the command line.
Definitely seems like this problem: https://developer.apple.com/forums/thread/660087
Updating XCode fixed the problem (12.4).

Code Signing Error: Verify the value of the CODE_SIGN_ENTITLEMENTS build setting

I am using swift 4 with Xcode 9. My app run perfectly on the emulator. When I try to Archive for build .ipa file then only get this error. Is there any other way to share the app with a client?
Code Signing Error: The file "/Users/imran-mac/Desktop/Orlando Dev/njm-app-fiverr/NJM iOS/NJM/NO" could not be opened.
Verify the value of the CODE_SIGN_ENTITLEMENTS build setting for target "NJM" and build configuration "Release" is correct and that the file exists on disk.
Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.2'

xcodebuild command for Xcode 8 beta to set provisioning profile and team ID

I am not able to build a project from command line in the latest Xcode 8 beta version. Can you please let me know the "xcodebuild" commands for Xcode 8 beta version to build a project through command line. previous commands which we used in previous versions of Xcode does not work now. Every time it throws and error : "Check dependencies
Signing for MyTestApp3 requires a development team. Select a development team in the Target Editor.
Code signing is required for product type 'Application' in SDK 'iOS 10.0'"
Command i used to build - xcodebuild -project MyTestApp3.xcodeproj -sdk iphoneos -configuration Release clean build DEBUG_INFORMATION_FORMAT=dwarf-with-dsym DSTROOT=build GCC_GENERATE_DEBUGGING_SYMBOLS=YES SHARED_PRECOMPS_DIR=build OBJROOT=build SYMROOT=build PROVISIONING_PROFILE_SPECIFIER= CODE_SIGN_IDENTITY="iPhone Distribution: Our Distribution Certificate".
Did you try DEVELOPMENT_TEAM command line parameter?
It can also be set in Xcode (General and Build Settings tabs).
I found the solution by this answer!
Mybe you also want to know how to get the 10-digit team id. Well, I found it in the output of command
xcodebuild -showBuildSettings -project <YourProject> |grep DEVELOPMENT_TEAM

Cannot build XCode project from command line but can from XCode

I've created in XCode a simple navigation-based iPhone app. The app builds and runs properly from under XCode but I cannot get it to build from command line.
From terminal I execute:
xcodebuild -project George.xcodeproj -alltargets -parallelizeTargets -configuration Debug build
but I get that error:
=== BUILD NATIVE TARGET George OF PROJECT George WITH CONFIGURATION Debug ===
Check dependencies
[BEROR]Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default keychain
** BUILD FAILED **
The following build commands failed:
Check dependencies
(1 failure)
Is there something wrong with the way I try to handle it?
In addition to unlocking the keychain, you might also specify the codesign identity (or set it in your target). Development certs take the form 'iPhone Developer: Company Inc', distribution certs like this 'iPhone Distribution: Company Inc'.
xcodebuild -project George.xcodeproj -alltargets -parallelizeTargets -configuration Debug build CODE_SIGN_IDENTITY='iPhone Developer: Company Inc'
You can build from the command-line a build targeted at the simulator without signing issues.
This solved the signing issue for me:
xcodebuild -sdk iphonesimulator
Source:
xcodebuild Code Sign error: No matching codesigning identity found:
That's particularly useful if the command line build is there only to sanity check the source code in a continuous integration setup.
Most probably your keychain is locked. Try unlocking it before executing the script, you can do it from command line (right before building):
security unlock -p YourPasswordToKeychain ~/Library/Keychains/login.keychain
Note, I'm using "login" keychain which could be different in your case
Also, if that doesn't help, try removing all other parameters and just leave smth like this:
xcodebuild -configuration Debug and clean beforehand xcodebuild -configuration Debug clean
I'm using shenzhen, it shows this error too.
Turns out, it happens when I plug in my iPad but it is not in the provision profile. By passing --verbose to shenzhen. it shows:
Check dependencies
Code Sign error: No matching provisioning profiles found: None of the valid provisioning profiles include the devices:
XXXX’s iPad
CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 8.3'
unplug the device, everything works just fine...
Depending on the purpose of your script, it may also be sufficient to just turn off code signing in the script, which you can do by setting CODE_SIGN_IDENTITY=''
xcodebuild -project George.xcodeproj -alltargets -parallelizeTargets -configuration Debug build CODE_SIGN_IDENTITY=''
Obviously that's no good if you are trying to do a final build from a script, but it may be fine if you're just trying to do a test build for continuous integration (eg from Jenkins, to make sure that nobody has broken anything).
I had an archiving error similar but not quite the same as the original post:
** ARCHIVE FAILED **
The following build commands failed:
Check dependencies
(1 failure)
This turned out to be a missing Application Service (in my case, the HealthKit service/entitlement), which I had enabled in my development App ID but not my production App ID.
You enable services in the Apple Member Center: https://developer.apple.com/account/ios/identifiers/bundle/bundleList.action
This can be fixed in XCode 8.0 by changing from "iOS Distribution" to "iOS Development" in XCode. It doesn't seem like it should work, but it does for some reason.