I have .p12 certificate installed and a provisioning profile.
When i Run the Project Created in Objective -C , it runs perfectly fine in my iOS Device(ver 7.1)
but when I run Project created in Swift it throws me an Code sign error as:
Couldn't codesign /Users/sulabh/Library/Developer/Xcode/DerivedData/FacebookTutorial-fcrwkfacnatqsfcowdihbdhybvhz/Build/Products/Debug-iphoneos/FacebookTutorial.app/Frameworks/libswiftCore.dylib: codesign failed with exit code 1
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-stdlib-tool failed with exit code 1
I have tried reinstalling xcode, and removing certificate from keychain, changing Build setting. but nothing works for Swift project.
What is the issue and how could I resolve it?
You need to re-generate your provisioning profile from Apple Developer Center. As far as I know they add something new to profiles and that causes the problem.
For me, the problem was that I forgot to install my new provisioning profile after downloading it. I just had to click on it to open it in Keychain Access and all of a sudden the problem was fixed.
Make sure your provisioning file contains the correct bundle id for your swift project. If you are using push service, also double check if the push service certificate is correct. Many problems are related to bundle id mismatch.
Also, explicitly choose the corresponding signing certificate and provisioning file for each project. Using automatic may cause issue as well.
I tried a number of solutions, and what ended up fixing it was updating Xcode to the latest version (from 7.2.x to 7.3.x).
I renamed the old provision and create a new profile with new name and worked fine , for example if your old file name is APP.mobileprovision
change it to APP_New.mobileprovision
from iOS Provisioning website and add it again
I restarted Xcode, cleaned build folder and checked certificates,provisioning profiles.It worked for me