ibm-bluemix-mobile-services/bms-clientsdk-cordova-plugin-push

ARCHIVE FAILED - Code Signing Error: BMSAnalyticsAPI - Xcode 9

Opened this issue · 34 comments

I get the following error whilst executing cordova build ios:

Code Signing Error: The file "/XXX/platforms/ios/Pods/Pods/Entitlements-Debug.plist" could not be opened. Verify the value of the CODE_SIGN_ENTITLEMENTS build setting for target "BMSAnalyticsAPI" and build configuration "Debug" is correct and that the file exists on disk.
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.

** ARCHIVE FAILED **

If I open the created workspace in Xcode a dialog opens with the following message:

"Unsupported Swift Version"
The project "Pods" contains source code developed with Swift 2.x. Xcode 9 does not support building or migrating Swift2.x targets.

Use Xcode 8.x to migrate the code to Swift 3.

@GlenMasters you dont have to do the migration part. We have done it already .

Do the following to fix the issue,

  1. open Xcode 9, and go to Xcode->preferences->Locations . Change the Command Line tools to Xcode 9.* (If its not there please download it from here https://developer.apple.com/download/more/ )

  2. Now go the project and go Targets->BuildSettings

  3. Add your signing credentials and certificates

  4. Go to capabilities and enable Push Notifications and BackGround Modes -> Remote notification

  5. go to the Pods project (In navigator area) and go to the BMSAnalyticsAPI

  6. Go to the build Settings and add the swift version (Do the same for BMSPush And BMSCore also)

No build the project in Xocde .

To configure the signing credentials automatically follow this - https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-cordova-plugin-push#adding-auto-signing-in-ios

Hi @AnanthaKrish

I have followed this process and can get a successful build and deploy from within the Xcode environment.

However I still experience an ** ARCHIVE FAILED ** error when using the cordova build tools.
e.g.

cordova build ios --buildConfig 

The error is:

=== BUILD TARGET BMSAnalyticsAPI OF PROJECT Pods WITH CONFIGURATION Debug ===

Check dependencies
Code Signing Error: The file "/Users/glenmasters/Documents/workspace/Celadin-Lime2/platforms/ios/Pods/Pods/Entitlements-Debug.plist" could not be opened. Verify the value of the CODE_SIGN_ENTITLEMENTS build setting for target "BMSAnalyticsAPI" and build configuration "Debug" is correct and that the file exists on disk.
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.

@GlenMasters Hi,

  1. Your signing credentials are not there it seems. please add them properly
  2. Open the project in Xcode. Go to the pods section. set the Swift version which is compatible for your project.

While doing the archive try to do it from Xcode itself. So that you will come to know where are the issues correctly.

@AnanthaKrish

As I said - I have followed your instructions - and it DOES build in Xcode.

My issue is that it does not build at the command line.

@GlenMasters Hi, disable the code signing in pod files try.
Before that please check which command line you are using. Go to Xcode->preferences->Locations and change the Command Line tools to Xcode 9.2

@AnanthaKrish
Hi, My command Line tools are: XCode 9.2 (9c40b) - which looks correct.
I am not sure what you mean by "disable the code signing in pod files" Is this something I'd do from within XCode?

@GlenMasters Yes. I think its doing a code signing for the pod files.

@AnanthaKrish

This is how my project looks by default - before I change anything. What should I do next?

xcode

@GlenMasters Check the build settings -> signing of each pod. And disable code signing there

@AnanthaKrish

Do you mean this screen? If so what do I change?

xcode2

@GlenMasters That looks fine. Did you change the bundle id in config.xml ?

@AnanthaKrish

If by bundle id you mean the value here, then yes.

<widget android-versionCode="109026" id="com.celadin.gtt2018" ios-CFBundleVersion="1.9.26" version="1.9.26" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

@GlenMasters Hi, looks like this is an apache cordoca issue.

i have a work around for you.

  • Before starting this please clear the Deriveddata (/Users/glenmasters/Library/Developer/Xcode/DerivedData )
  • Then add provisioningProfile part in the build.json and add bundle id in config.xml

After adding the push Plugin,

  1. Go to Platforms/ios/cordova/build.xcconfig and comment out following lines - 30,31 & 43

        30. //CODE_SIGN_IDENTITY = iPhone Developer
         31. //CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer
         43. //CODE_SIGN_ENTITLEMENTS = $(PROJECT_DIR)/$(PROJECT_NAME)/Entitlements-$(CONFIGURATION).plist
    
  2. Go to the root folder and do the cordova build ios --buildConfig. This may fail. thats because of the absence of Debug-iphonesimulator in DerivedData.

  3. Then open the project in Xocde. Build there. Go and check the Deriveddata->...->Debug-iphonesimulator. You will see all those Pod dependencies there.

  4. Now come back to command line and run cordova build ios --buildConfig. this will build the project successfully.

@AnanthaKrish

Hi, I am now getting a different error:

=== BUILD TARGET BMSAnalyticsAPI OF PROJECT Pods WITH CONFIGURATION Debug ===

Check dependencies
Code Signing Error: BMSAnalyticsAPI does not support provisioning profiles. BMSAnalyticsAPI does not support provisioning profiles, but provisioning profile NO_SIGNING/ has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor.

** ARCHIVE FAILED **

The XCode build worked and deployed successfully both to the simulator and a physical device.
(Since we made the change to build.xconfig Xcode no longer asks for the swift versions of the Pod files to be set. So the build was done with no changes to the project settings).

The pod files dependencies were all created in the Deriveddata->...->Debug-iphonesimulator folder.

@GlenMasters hi, open the project Xcode, in pods BMS__-> Build settings change the NO_SIGNING to Automatic.

Then run the build command in terminal

@AnanthaKrish

Ok - I have done that. I now get this error:

** ARCHIVE FAILED **


The following build commands failed:
        Ld /Users/glenmasters/Library/Developer/Xcode/DerivedData/G&TT_2018-ddzadtounszdnzaljzuvbkiomeue/Build/Intermediates.noindex/ArchiveIntermediates/G&TT\ 2018/IntermediateBuildFilesPath/Pods.build/Debug-iphoneos/BMSAnalyticsAPI.build/Objects-normal/arm64/BMSAnalyticsAPI normal arm64
        Ld /Users/glenmasters/Library/Developer/Xcode/DerivedData/G&TT_2018-ddzadtounszdnzaljzuvbkiomeue/Build/Intermediates.noindex/ArchiveIntermediates/G&TT\ 2018/IntermediateBuildFilesPath/Pods.build/Debug-iphoneos/BMSAnalyticsAPI.build/Objects-normal/armv7/BMSAnalyticsAPI normal armv7
(2 failures)
(node:2226) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error code 65 for command: xcodebuild with args: -xcconfig,/Users/glenmasters/Documents/workspace/Celadin-Lime2/platforms/ios/cordova/build-debug.xcconfig,-workspace,G&TT 2018.xcworkspace,-scheme,G&TT 2018,-configuration,Debug,-destination,generic/platform=iOS,-archivePath,G&TT 2018.xcarchive,archive,CONFIGURATION_BUILD_DIR=/Users/glenmasters/Documents/workspace/Celadin-Lime2/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/glenmasters/Documents/workspace/Celadin-Lime2/platforms/ios/build/sharedpch,EMBEDDED_CONTENT_CONTAINS_SWIFT = YES,ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO,LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"
(node:2226) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@GlenMasters Archive it through Xcode .. Else use Xcode commad line tools to archive .

@AnanthaKrish

I am trying to achieve a command line build. I need this for our CI process. Archiving through XCode defeats this purpose. I can already build through XCode.
As far as using XCode command line tools is concerned - this is what cordova already does and reports Archive Failed.

@GlenMasters Which command are you trying ?

@AnanthaKrish

cordova build ios --buildConfig 

@GlenMasters Try removing the buildFlag values from build.json. Retry the build after that

@AnanthaKrish

No that didn't work. Archive failed again.

Is there a working demo for this that I could fork from or clone?

@GlenMasters this is a apache cordova issue ... This issue will come when there is a pod dependencies. I will try to find way, will let you know.

No there is no working model for CI builds.

Hii Anatha,This BMS push not working in iPhone 5s device.It gives me a error dylib fatal error and image not found.It works on emulerator and Android real devices but it gives me a fatal error When running on a iPhone real devices through xcode.Need your urgent support.Please help me regarding these.

Hii Anatha,This BMS push not working in iPhone 5s device.It gives me a error dylib fatal error and image not found.It works on emulerator and Android real devices but it gives me a fatal error When running on a iPhone real devices through xcode.Need your urgent support.Please help me regarding these.

@ayushbafna24 Hi, please do a pod install or pod update inside platforms/ios. Then open the project.XCWorkspace.

Do a clean build (cmd+shift+option+k) then cmd+b

This should solve the issue

@ayushbafna24 Please create service ticket.

We are having the same issue. Everything works through xcode, receiving push and so on. But through command line build we also get:

** ARCHIVE FAILED **

The following build commands failed:
	Ld /Users/andres/Library/Developer/Xcode/DerivedData/Art_Andersen_CPH-cwjuacqymuiidqgpslsvkfmghdyv/Build/Intermediates.noindex/ArchiveIntermediates/Art\ Andersen\ CPH/IntermediateBuildFilesPath/Pods.build/Debug-iphoneos/BMSAnalyticsAPI.build/Objects-normal/armv7/BMSAnalyticsAPI normal armv7
(1 failure)

@kumpanen We are trying to find a solution. As of now please use the Xcode directly to archive ..

You need to have cordova 6.3.0 to create and build first your project in XCode. Then change the compilation Swift to 3.2 and it should be good