Running OClint in Xcode bots - ios

Hey i want to run oclint using Xcode bots.
Currently what i am doing is runing oclint as a post build run script.
But it is always unable to find the provisioning profile.
Here is what i am doing
xcodebuild -target MyTarget -configuration Debug clean build | tee xcodebuild.log
oclint-xcodebuild
oclint-json-compilation-database -- -max-priority-1 99999 -max-priority-2 99999 -max-priority-3 99999
and this is the output that i get from the xcode bot
[BEROR]Code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “6F753CA0-4435-40FF-B2F4-15B64D0F7AEE”, however, no such provisioning profile was found.
[BEROR]CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 7.1'
Although normal builds without oclint work fine.

I had this error, and if you switch the provisioning profile to Automatic it will build successfully on the Xcode Bot. However, this may not work for actually building your project, but it should get the bot working for you to verify that there isn't another issue with it.

Related

Codemagic: Error when building for iOS "No profiles for 'com.example.example' were found: Xcode could't find any iOS App Development

I try to build for iOS my app with Codemagic. I followed the steps for signing iOS apps in the Codemagic docs.
No profiles for 'com.example.example' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.example.example'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
Full error message:
Archiving fun.gatch.chat.example...
Automatically signing iOS for device deployment using specified development team in Xcode project: JB7VLPB7F6
Running pod install... 85.5s
Running Xcode build...
Xcode archive done. 9.5s
Failed to build iOS app
Error output from Xcode build:
↳
** ARCHIVE FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/m7/h1mg7c7x40ddjz6mxjxm3htr0000gn/T/flutter_tools.TDA8uV/flutter_ios_build_temp_dirVLpaDD/temporary_xcresult_bundle
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
error: No profiles for 'fun.gatch.chat.example' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'fun.gatch.chat.example'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner')
Result bundle written to path:
/var/folders/m7/h1mg7c7x40ddjz6mxjxm3htr0000gn/T/flutter_tools.TDA8uV/flutter_ios_build_temp_dirVLpaDD/temporary_xcresult_bundle
Error (Xcode): No profiles for 'fun.gatch.chat.example' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'fun.gatch.chat.example'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
It appears that there was a problem signing your application prior to installation on the device.
Verify that the Bundle Identifier in your project is your signing id in Xcode
open ios/Runner.xcworkspace
Also try selecting 'Product > Build' to fix the problem:
Encountered error while archiving for device.
My problem was that the values for APP_STORE_CONNECT_KEY_IDENTIFIER, CERTIFICATE_PRIVATE_KEY were wrong.
This was a little tricky, because the message for this printed out in the step where I set up the keychain. The error messages give you a concrete reasoning why the signing is failing, like:
GET https://api.appstoreconnect.apple.com/v1/bundleIds?limit=100&sort=name&filter%5Bidentifier%5D=bundle.id&filter%5Bplatform%5D=IOS returned 401: Authentication credentials are missing or invalid. - Provide a properly configured and signed bearer token, and make sure that it has not expired. Learn more about Generating Tokens for API Requests https://developer.apple.com/go/?id=api-generating-tokens
app-store-connect: error: argument --certificate-key: Provided value
app-store-connect: error: argument --private-key: Provided value is not a valid PEM encoded private key

Codemagic iOS Flutter deploy fails on archive

I have a question where and how to add allowProvisioningUpdates in Xcode? My Codemagic account is connected with App Store Connect, bundle id and app are also created.
Build process fails on the app archive, but Xcode build is successfully done.
Can I somehow add allowProvisioningUpdates to this command?
Execute "xcodebuild -workspace /Users/builder/clone/ios/Runner.xcworkspace -scheme Runner -config Release -archivePath build/ios/xcarchive/Runner_1pxkp9aq.xcarchive archive COMPILER_INDEX_STORE_ENABLE=NO"
Every time build process returns me this message after fail:
Error: No profiles for 'com.xxx.xxx' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.xxx.xxx'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner')
Do you have some suggestions, on how to resolve this?
Thanks.
The error itself is probably actually unrelated, and adding the flag will not change much.
If you're using .yaml and are trying to set up automatic code signing I would encourage you to add xcode-project use-profiles before your build step.
For automatic .yaml code signing with Flutter iOS the workflow should include:
a) keychain initialize
b) app-store-connect fetch-signing-files "your.bundle.id" --type IOS_APP_STORE --create
If you wish to use development certificate then IOS_APP_DEVELOPMENT as type.
d) keychain add-certificates
e) xcode-project use-profiles
f) flutter build ios
g) xcode-project build-ipa --workspace "ios/Runner.xcworkspace" --scheme "Runner" (change to your workspace and scheme)
In addition you should implement versioning, if you do not want to do it manually for each build.
If you're not using automatic code signing, then you will need to upload your provisioning profile and the process will be a bit different. But the process is somewhat similar, you can take a look at the documentation: https://docs.codemagic.io/code-signing-yaml/signing-ios/

xcodebuild using wrong provisioning profile

I have a bash script where I am trying to automate pushing an IPA to TestFlight. Currently this script is successfully uploading to the app-store with an ad-hoc provisioning profile and not my distribution profile as such I am unable to push the build to TestFlight as it does not have the beta-reports-active key. This is easily fixable from within XCode but I have had no luck using command line which is integral to what I want to do. This is my current command trying to use manual signing:
xcodebuild archive -workspace $NAME.xcworkspace -allowProvisioningUpdates -scheme $NAME -configuration Release -archivePath ../builds/$NAME.xcarchive DEVELOPMENT_TEAM=$TEAM_ID CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY="iOS Distribution: MY_NAME" PROVISIONING_STYLE=Manual PROVISIONING_PROFILE_SPECIFIER="PROVISIONING PROFILE "
Is there a way of getting the correct provisioning profile through command line
EDIT
Examples of what I have tried:
Downloading and inserting the provisoning profile int0 ~/Library/MobileDevice/Provisioning\ profiles and then using PROVSIONING_PROFILE_SPECIFIER to point to the profile
Inserting the app-store method into the export options plist file
Creating new ExportOptions file that specifies manual signing as well as the provision profile being used - so far getting a signing error due to no provisioning profile being found
Hope this ^ is clear
I had a similar problem, I was using fastlane to push to testflight and it automatically kept pulling the wrong provisioning profile..
When I dug deeper by running
xcodebuild -showBuildSettings -workspace Freshdesk.xcworkspace -scheme <My Build scheme>
I realised that no matter what scheme I picked I kept getting the same provisioning profile in the command line.
I then dug into xcode and chanced on this parameter
This was set to staging and I could never sign my app for the app store build, I changed it to production and it fixed my problems
You can find this under "configurations" in the info tab of your project and not the target
I hope this helps!

Xcode Plugin of Jenkins not working with Xcode9.0

I am using Xcode plugin of Jenkins which is working for Xcode 8.3 but it is not compatible with Xcode 9.0 because of changes in code signing .
I am getting the error as below :
error: exportArchive: "SwiftDemo.app" requires a provisioning profile.
Error Domain=IDEProvisioningErrorDomain Code=9 ""SwiftDemo.app" requires a provisioning profile."
UserInfo={NSLocalizedDescription="SwiftDemo.app" requires a
provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to
the "provisioningProfiles" dictionary in your Export Options property
list.}
** EXPORT FAILED **
I was also getting this error. But now solved the issue. I can build successfully in Xcode9.0 and Xcode9.2.
Here are the steps mentioned below to overcome above error.
Manually generate and export the IPA file with Xcode. This will create a file name ExportOptions.plist in the exported folder.
Copy that file to workspace root folder.
In Jenkin General build settings, uncheck “Pack application, build and sign .ipa?”, and check “Generate Archive?”.
And last, add an Execute shell like this,
xcodebuild -exportArchive -archivePath ${WORKSPACE}/build/YourProject.xcarchive -exportPath ${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}/archive -exportOptionsPlist ${WORKSPACE}/ExportOptions.plist
what works for me:
Keychain: Move two signing certificates (iphone dev and iphone distr) from Login to System.
make sure that "trust" property set to "system default"

building xcode project from jenkins fails. when building in command line runs just fine. why?

building xcode project from jenkins fails.
when building in command line runs just fine.
why?
this is is the error I get:
[BEROR]Code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “_UUID_”, however, no such provisioning profile was found.
[BEROR]CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 7.1'
this is the command line used:
xcodebuild -project PROJECTNAME.xcodeproj/ -target TARGETNAME -configuration Release -sdk iphoneos7.1 clean build
ps: anything with OBJECT was censored so this question can appear online, there was real data there before.
Are you using the login key-chain or did you create a different key-chain for jenkins builds app signing?
If you are just using the login key-chain make sure you unlock the key-chain during the build.
If you are using a different key-chain make sure you swap key-chains and then unlock it.
Jenkins - Xcode build works codesign fails - this thread is quite informative.
Also adding these 2 commands to your build can help you debug it:
/usr/bin/security list-keychains
/usr/bin/security find-identity

Resources