CocoaPods / CocoaPods

The Cocoa Dependency Manager.
https://cocoapods.org/
Other
14.5k stars 2.62k forks source link

[Catalyst] Podspec Resource Bundle requires a development team #8891

Open chrisballinger opened 5 years ago

chrisballinger commented 5 years ago

Podspec resource bundles now require a development team / signing identity. I think this only affects static libraries with resource bundles and not when the resources are bundled within a framework.

I will take a look at the Pods project diff to see what keys need to be added and update this issue. Maybe this will require an update to the Xcodeproj gem?

Default after pod install

Screen Shot 2019-06-05 at 10 51 00 PM Screen Shot 2019-06-05 at 10 52 50 PM

Manually modified Pods project resolves the issue

Screen Shot 2019-06-05 at 10 53 04 PM

Originally posted by @chrisballinger in https://github.com/CocoaPods/CocoaPods/issues/8877#issuecomment-499359485

Workaround

Workaround available by Podfile hack here: https://github.com/CocoaPods/CocoaPods/issues/8891#issuecomment-546636698

stale[bot] commented 4 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

xiao99xiao commented 4 years ago

Still not resolved as macOS 10.15 is already released.

chrisballinger commented 4 years ago

Here is a Podfile hack workaround:

def fix_config(config)
  # https://github.com/CocoaPods/CocoaPods/issues/8891
  if config.build_settings['DEVELOPMENT_TEAM'].nil?
    config.build_settings['DEVELOPMENT_TEAM'] = '<YOUR TEAM ID HERE>'
  end
end

post_install do |installer|
  installer.generated_projects.each do |project|
    project.build_configurations.each do |config|
        fix_config(config)
    end
    project.targets.each do |target|
      target.build_configurations.each do |config|
        fix_config(config)
      end
    end
  end
end
chrisballinger commented 4 years ago

This workaround might not actually work after all. Although it builds and runs locally after the fix, the binary is not accepted by App Store Connect, and is rejected with code ITMS-90284 "Invalid Code Signing".

ITMS-90284: Invalid Code Signing - The executable 'Example.app/Contents/Resources/ExamplePodBundle.bundle' must be signed with the certificate that is contained in the provisioning profile.

Someone else posted about this issue here: https://stackoverflow.com/questions/58547010/ios-catalyst-cocoapod-framework-error-signing-requires-a-development-team

chrisballinger commented 4 years ago

I submitted a radar FB7425571 because I really don't know how to fix this. It seems that resource bundle targets aren't compatible with Mac Catalyst App Store builds at all. It works just fine when running locally exported via Developer ID.

So far it seems the only workaround is to remove all resource bundle targets, which might be a big issue especially because they are "strongly recommended" in the podspec docs: https://guides.cocoapods.org/syntax/podspec.html#resource_bundles

chrisballinger commented 4 years ago

Another workaround is to create exported archives of the resource bundles and then include that version instead.

Neil20170220 commented 4 years ago

@chrisballinger you can try set 'Signing Certificate' to 'Sign to Run Locally'. like this

honghaoz commented 4 years ago

This is probably a better way to fix it, without specifying the team id.

post_install do |installer|
    installer.pods_project.targets.each do |target|
        # Fix bundle targets' 'Signing Certificate' to 'Sign to Run Locally'
        if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
            target.build_configurations.each do |config|
                config.build_settings['CODE_SIGN_IDENTITY[sdk=macosx*]'] = '-'
            end
        end
    end
end
paulb777 commented 4 years ago

Relatedly, adding the option CODE_SIGN_IDENTITY='-' is a workaround for xcodebuild invocations.

amorde commented 4 years ago

Adding CODE_SIGN_IDENTITY[sdk=macosx*]='-' would be a relatively straightforward change on the CocoaPods side - if this is the correct way to do it than we can move forward with that

paulb777 commented 4 years ago

Automatically signing to run locally is the right fix for local development. I'm not sure about deployment.

amorde commented 4 years ago

Won't Xcode re-sign when exporting archives?

ConfusedVorlon commented 4 years ago

Just to confirm settings for deployment through the appstore:

Setting a team manually, and setting signing certificate 'development' results in the archive being signed by XCode and uploading to the store, but being rejected during processing with:

ITMS-90284: Invalid Code Signing - The executable 'Off.app/Contents/Frameworks/Material.framework/Versions/A/Resources/com.cosmicmind.material.fonts.bundle' must be signed with the certificate that is contained in the provisioning profile

Setting a team manually, and setting signing certificate 'sign to run locally' uploads correctly and results in a build that I can select for release in appstore connect.

amorde commented 4 years ago

So it's sounding like the CODE_SIGN_IDENTITY[sdk=macosx*]='-' works for development but not uploading to the App Store.

This is a bit problematic since we'll now need to pull the development team ID from somewhere. We can add code to infer it from the project but we may need new DSL for specifying it within the target block in the Podfile

ky1vstar commented 3 years ago

CODE_SIGN_IDENTITY[sdk=macosx*]='-' works for uploading to the App Store.

nikolaykasyanov commented 2 years ago

It looks like Xcode 13.3 beta now imposes the same requirement on resource bundles even when building for iOS, not Mac Catalyst.

UPD: I tried CODE_SIGN_IDENTITY[sdk=iphone*]='-' but it didn't help, Xcode is still asking me to set a team ID.

alessandrodn commented 2 years ago

It looks like Xcode 13.3 beta now imposes the same requirement on resource bundles even when building for iOS, not Mac Catalyst.

UPD: I tried CODE_SIGN_IDENTITY[sdk=iphone*]='-' but it didn't help, Xcode is still asking me to set a team ID.

+1

nikolaykasyanov commented 2 years ago

The newly introduced iOS behavior has been reported to Apple as FB9874350.

przemyslaw-szurmak commented 2 years ago

I want to confirm I have exactly same issue when compiling for iOS device under Xcode 13.3 beta 2 :(

JeffGuKang commented 2 years ago

image I set manually each Pod project having error with team signing. And it works now.

lionep commented 2 years ago

Thanks @JeffGuKang

On my side, I didn't have the tab "Signing & Capabilities" for the Pod, I had to set the "Development Team" in build settings for this Pod.

monchote commented 2 years ago

Setting the "Development Team" didn't work for me unfortunately.

The newly introduced iOS behavior has been reported to Apple as FB9874350.

@nikolaykasyanov Is that radar still open? I can't seem to find it.

przemyslaw-szurmak commented 2 years ago

Good news, seems to be fixed with Xcode 13.3 RC!

nikolaykasyanov commented 2 years ago

@monchote I didn't cross-post it to openradar or anywhere, sorry.

mikehardy commented 2 years ago

Lots of people solved lots of problems! I solved a few just yesterday. For this specific problem, the comment above worked for me: https://github.com/CocoaPods/CocoaPods/issues/8891#issuecomment-573301570

mikehardy commented 2 years ago

I think you'll need to post a great deal more information in order for anything useful to come from your comments, like a future solution. https://stackoverflow.com/help/how-to-ask / https://stackoverflow.com/help/minimal-reproducible-example

domfz commented 2 years ago

This now again happens with Xcode 14 beta. https://github.com/CocoaPods/CocoaPods/issues/8891#issuecomment-573301570 did not work for me.

mikehardy commented 2 years ago

I have never had it work consistently with 13.3 or 14rc without the signing workaround, personally. I just leave it on in my testing harness

https://github.com/mikehardy/rnfbdemo/blob/51ef9f125d67b599854de81764b9451514a5608e/make-demo.sh#L244-L246

robinchanme commented 2 years ago

This now again happens with Xcode 14 beta. #8891 (comment) did not work for me.

+1

pengzishang commented 2 years ago

image I set manually each Pod project having error with team signing. And it works now.

you need to set 'DEVELOPMENT_TEAM' with you team id, not team name

ezamagni commented 2 years ago

This now again happens with Xcode 14 beta. #8891 (comment) did not work for me.

+1

ghosthk commented 2 years ago

Only set teamid to fix. this code work for me, xcode14 beta2。

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.name != "Release"
config.build_settings['DEVELOPMENT_TEAM'] = "  debugTeamId. "
else
config.build_settings['DEVELOPMENT_TEAM'] = " releaseTeamId. "
end
end
end
end
li6185377 commented 2 years ago

Only set teamid to fix. this code work for me, xcode14 beta2。


post_install do |installer|
# Get main project development team id
dev_team = ""
project = installer.aggregate_targets[0].user_project
project.targets.each do |target|
target.build_configurations.each do |config|
if dev_team.empty? and !config.build_settings['DEVELOPMENT_TEAM'].nil?
dev_team = config.build_settings['DEVELOPMENT_TEAM']
end
end
end
# Fix bundle targets' 'Signing Certificate' to 'Sign to Run Locally'
installer.pods_project.targets.each do |target|
    if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
        target.build_configurations.each do |config|
            config.build_settings['DEVELOPMENT_TEAM'] = dev_team
        end
    end
end

end

jordimele commented 2 years ago

Hello,

This error now happens again with Xcode 14 beta 4.

Workaround with Podfile works: #8891 (comment)

doge1024 commented 1 year ago

fix

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
      target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
      end
    end
  end
end
thanhcuong1990 commented 1 year ago

fix

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
      target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
      end
    end
  end
end

This work with Xcode 14

BRoy98 commented 1 year ago

fix

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
      target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
      end
    end
  end
end

If the error doesn't fix after this change, run pod install.

michaelknoch commented 1 year ago

Is it still needed with the public Xcode 14 release?

dfed commented 1 year ago

Is it still needed with the public Xcode 14 release?

Yes.

ohrl commented 1 year ago

just update 14.0.1 RC, still need

paulocoutinhox commented 1 year ago

Im with Xcode 14 and with the same problem. I have five dependencies with this error when execute pod install.

The product_type in the fix below need be changed one by one that error happen or it is generic?

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle" # <--- this
      target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
      end
    end
  end
end
paulocoutinhox commented 1 year ago

The code above fix for all dependencies together. Thanks.

andrerds commented 1 year ago

fixar

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
      target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
      end
    end
  end
end

l

Friends, I add this code inside the block >

DO NOT MODIFY -- auto-generated by Apache Cordova

source 'https://github.com/CocoaPods/Specs.git' source 'https://cdn.cocoapods.org/' platform :ios, '11.0' use_frameworks! target 'KAccess' do project 'KAccess.xcodeproj' pod 'PhoneNumberKit', '~> 3.3' pod 'Firebase/Core', '9.1.0' pod 'Firebase/Auth', '9.1.0' pod 'Firebase/Messaging', '9.1.0' pod 'Firebase/Performance', '9.1.0' pod 'Firebase/RemoteConfig', '9.1.0' pod 'Firebase/InAppMessaging', '9.1.0' pod 'Firebase/Firestore', '9.1.0' pod 'Firebase/Crashlytics', '9.1.0' pod 'Firebase/Functions', '9.1.0' pod 'Firebase/Installations', '9.1.0' pod 'GoogleSignIn', '6.2.1' pod 'GoogleTagManager', '7.4.1' end

Sorry, I'm not a native developer so something is beyond my knowledge.

paulocoutinhox commented 1 year ago

Post your code as code with markdown char.

Put the post install code in the end of your file Podfile.