CocoaPods / Xcodeproj

Create and modify Xcode projects from Ruby.
http://rubygems.org/gems/xcodeproj
MIT License
2.36k stars 458 forks source link

Create Info.plist for resource bundles #259

Open neonichu opened 9 years ago

neonichu commented 9 years ago

Seems like the root cause of CocoaPods/CocoaPods#3310 is that we don't create a proper Info.plist for resource bundles, whereas Xcode does that. Xcodeproj::Project.new_resources_bundle() should create that so that the resource bundle is actually of the same form as those Xcode itself creates:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>com.contentful.$(PRODUCT_NAME:rfc1034identifier)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>BNDL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>NSPrincipalClass</key>
    <string></string>
</dict>
</plist>
AliSoftware commented 9 years ago

Would it make sense to make it optional, defaulting to true? new_resources_bundle(with_info_plist = true)

segiddins commented 9 years ago

@AliSoftware don't see why

AliSoftware commented 9 years ago

Dunno, it feels strange to force this Info.plist file to be created, seems like a workaround to make Xcode happy.

BTW, should we create the exact same Info.plist file as Xcode does, or simplify it a bit, especially I don't see why CFBundleExecutable would be relevant for a resources bundle, neither would NSPrincipalClass

neonichu commented 9 years ago

I wouldn't say it's a workaround, without a Info.plist, it is not really a bundle. We were just lucky that it mostly works without one :)

mchiesa commented 8 years ago

I'm trying to use the Xcodeproj gem to create an Xcode project from command line and I came across this issue. Is it possible to generate a Plist using this gem or should I create the file myself and add it to the project?

Thanks!

hhanesand commented 8 years ago

Hey @neonichu , I've been getting a series of errors while uploading an app that uses a pod that has a resource bundle, related to @AliSoftware 's comment above.

[15:14:47]: [Transporter Error Output]: ERROR ITMS-90535: "Unexpected CFBundleExecutable Key. The bundle at 'Payload/xxx.app/Frameworks/IssueReporter.framework/IssueReporterResources.bundle' does not contain a bundle executable. If this bundle intentionally does not contain an executable, consider removing the CFBundleExecutable key from its Info.plist and using a CFBundlePackageType of BNDL. If this bundle is part of a third-party framework, consider contacting the developer of the framework for an update to address this issue."

Pretty sure that is error is something Apple recently has begun enforcing.

I maintain the pod that the error originates from, but I'm not sure how to fix the issue. If I do what it says and remove the CFBundleExecutable from ResourceBundle-IssueReporterResources-Info.plist and set the CFBundlePackageType to BNDL, the upload completes without error, however I'm not sure how to fix it within the podspec. Here is the podspec of the pod that is causing the issue.

Here is an example of an info plist that does not cause errors during the upload process.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleIdentifier</key>
    <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>${PRODUCT_NAME}</string>
    <key>CFBundlePackageType</key>
    <string>BNDL</string>
    <key>CFBundleShortVersionString</key>
    <string>0.2.2</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>${CURRENT_PROJECT_VERSION}</string>
    <key>NSPrincipalClass</key>
    <string></string>
</dict>
</plist>
djbe commented 8 years ago

Had the same issue as @hhanesand today, I can confirm that the changes he mentioned fixed it.

hhanesand commented 8 years ago

Yes, fixed for me too!

This issue can probably be closed now.