Can't build project - libswiftAVFoundation.dylib: errSecInternalComponent error: Task failed with exit 1 signal 0 - ios

Suddenly I can't build project.
I got this error upon building :
Products/Debug-iphoneos/MyApp.app/Frameworks/libswiftAVFoundation.dylib
/usr/bin/codesign '--force' '--sign'
'E5DD0B9344567811AABBF46F5AA802C26FAD6696' '--verbose'
'/Users/vlad/Library/Developer/Xcode/DerivedData/MyApp-aohzmfeceiyidabrejtgjtlfukvs/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/libswiftAVFoundation.dylib'
/Users/vlad/Library/Developer/Xcode/DerivedData/MyApp-aohzmfeceiyidabrejtgjtlfukvs/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/libswiftAVFoundation.dylib:
errSecInternalComponent error: Task failed with exit 1 signal 0 {
/usr/bin/codesign '--force' '--sign'
'E5DD0B9344567811AABBF46F5AA802C26FAD6696' '--verbose'
'/Users/vlad/Library/Developer/Xcode/DerivedData/MyApp-aohzmfeceiyidabrejtgjtlfukvs/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/libswiftAVFoundation.dylib'
}
I tried to re-include Swift libraries but it didn't help.
This happened after I tried to connect to Firebase but then erased it from the pod file.
Anyone can tell me where the problem is and how to solve it?

Clean (shift + cmd + k)
Delete Derived data (click file -> workplace settings -> click the arrow under derived data and delete the entire folder)
Clean again
Rebuild

Related

React Native (Expo) - error: generate-pch command failed with exit code 1

Building a React Native Expo app (prebuild on iOS, not using Expo Go) and running into this esoteric error that I can't seem to find elsewhere on the internet.
I'll post it here for the next unlucky React Native dev, and perhaps I'll find a solution and post that too.
expo run:ios output:
⚠️ (../../Library/Developer/Xcode/DerivedData/MyProject-epxolwjjgmimbdefugnlecrdysuv/Build/Intermediates.noindex/PrecompiledHeaders/MyProject-Bridging-Header-2vyenlvwppgam.dia:1:1)
Command PrecompileSwiftBridgingHeader failed with a nonzero exit code
^ Could not read serialized diagnostics file: error(in target 'MyProject' from project 'MyProject')
❌ error: generate-pch command failed with exit code 1 (use -v to see invocation)
› 1 error(s), and 1 warning(s)
Failed to build iOS project. "xcodebuild" exited with error code 65.
Xcode build output:
<unknown>:0: error: error opening input file '/Users/jh/Code/MyProject/ios/MyProject/MyProject-Bridging-Header.h' (No such file or directory)
<unknown>:0: error: cannot open file '/Users/jh/Library/Developer/Xcode/DerivedData/MyProject-epxolwjjgmimbdefugnlecrdysuv/Build/Intermediates.noindex/PrecompiledHeaders/MyProject-Bridging-Header-e8n926ydzbc0.dia' for diagnostics emission (No such file or directory)
/Users/jh/Library/Developer/Xcode/DerivedData/MyProject-epxolwjjgmimbdefugnlecrdysuv/Build/Intermediates.noindex/PrecompiledHeaders/MyProject-Bridging-Header-e8n926ydzbc0.dia:1:1: warning: Could not read serialized diagnostics file: error("Failed to open diagnostics file") (in target 'MyProject' from project 'MyProject')
Command PrecompileSwiftBridgingHeader failed with a nonzero exit code
Expo SDK version 44. I'm on a 2022 Mac Studio M1.
Okay, found the solution!
I had used npx react-native-rename to rename my project, but it didn't rename the Swift bridging header.
It's located in ios/MyProject/<oldname>-Bridging-Header.h.
renamed: ios/MyProject/OldName-Bridging-Header.h -> ios/MyProject/MyProject-Bridging-Header.h
While I was doing this, I also discovered that several of my bundle identifiers hadn't been moved over either. Do a codebase search for com.yourorganization.youroldbundlename to find & replace those too.
The locations I had to update:
./ios/MyProject.xcodeproj/project.pbxproj
./ios/MyProject/Info.plist
./app.json

Jenkins return "unknown error -1=ffffffffffffffff" when building Xcode Project with Cocoapods

I'm getting below error when trying to build Xcode workspace on Jenkins
usr/bin/codesign --force --sign B5E96BDFADAF51D771B158A29BF1D16565215A2D --preserve-metadata=identifier,entitlements '/Users/servicebuild/Desktop/Jenkins/workspace/Hello-Branch/build/Hello Test.app/Frameworks/Alamofire.framework'
16:06:07 /Users/servicebuild/Desktop/Jenkins/workspace/Hello-Branch/build/Hello Test.app/Frameworks/Alamofire.framework: unknown error -1=ffffffffffffffff
16:06:07 Command /bin/sh failed with exit code 1
16:06:07
16:06:07 ** BUILD FAILED **
16:06:07
16:06:07
16:06:07 The following build commands failed:
16:06:07 PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/servicebuild/Library/Developer/Xcode/DerivedData/Hello-dcvxwbnovymfusbrvfyyekingznu/Build/Intermediates.noindex/Garanti\ Filo.build/Release-iphoneos/Hello\ Hello\ Test.build/Script-2617FEF7DE193736656550249B.sh
I have more than one targets and in workspace scheme targets that I created are ticked as shared (not the pod targets). In pod project every framework has "Don't Code Sign" (As Default). I can successfully get IPA export from Xcode. However, when I try to build in Jenkins I get this error.
I tried solution in below post but can't figure out. I think the problem is Jenkins is forcing to sign pods when It doesn't need to.
Codesign returned unknown error -1=ffffffffffffffff
I figured out how to run below code (posted in the post added in my question) and it worked. Important point is that giving right path for keychain and password. Otherwise, It doesn't work.
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k password ${KEYCHAIN}

Swift stdlib tool Error -> Task failed with exit 1 signal - IOS

I am trying to launch my developed app on my iphone and I am getting a build fail with the following error. I do not know how to address the problem. Please can someone advise? I can build the app on the simulator but not on the iphone.
error: Task failed with exit 1 signal 0 {
/usr/bin/codesign '--force' '--sign' 'CF34DF6AAC83D040CB9CA5907F171518DB7A331F' '--verbose' '/Users/johnDow/Library/Developer/Xcode/DerivedData/myApp-dfuggtbkfdkixtemtcsnzflclljy/Build/Products/Debug-iphoneos/myApp.app/Frameworks/libswiftCore.dylib'
}
Try to reset the derived Data
rm -rf /Users/johnDow/Library/Developer/Xcode/DerivedData/*
If that doesn't work I had to re install xcode AND restart computer to fix it

Command /usr/bin/codesign failed with exit code 1 Xcode CocoaPods

I've been trying to debug this error for hours, it says Command /usr/bin/codesign failed with exit code 1
Seems to involve the code signing, and I've refreshed provisioning profiles, removed Derived Data, cleaned the project, and tried everything else on SO but nothing works. Any help would be greatly appreciated. Here's the screenshot:
// Check those link i am sure you got your solution
Command /usr/bin/codesign failed with exit code 1
/usr/bin/codesign failed with exit code 1
command/usr/bin/codesign failed with exit code 1- code sign error

Jenkins error: /usr/bin/codesign --force failed exit code 1

I am configuring CI for my IOS project on MAC yosemite-OS and got on problem:
error: /usr/bin/codesign --force --preserve-metadata=identifier,entitlements,resource-rules --sign /Users/mitul/Desktop/jenkins_ios_profile/PCertificates.p12 --resource-rules=/var/folders/rj/cc6d38nn53v6tk8y4jn7ghkr0000gp/T/42RbMszHQX/Payload/XXX.app/ResourceRules.plist /var/folders/rj/cc6d38nn53v6tk8y4jn7ghkr0000gp/T/42RbMszHQX/Payload/XXX.app failed with error 1
even my build and archive are getting success but not able to make .ipa file
even tried all possibilities from this
/usr/bin/codesign failed with exit code 1 but no luck
Please help me what I am missing to do
My Xcode configuration is as follows:
Custom xcodebuild arguments:
CODE_SIGN_RESOURCE_RULES_PATH=/Users/mitul/Public/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ResourceRules.plist
rest are all with default setting
I unchecked the code signing checkbox in jenkins project configuration and it started building, hope it can help some else too!

Resources