Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource bundles not adding targeted device family when included in an Apple Watch target #9075

Closed
1 task done
Spilly opened this issue Aug 1, 2019 · 9 comments
Closed
1 task done
Milestone

Comments

@Spilly
Copy link
Contributor

Spilly commented Aug 1, 2019

Report

What did you do?

Added a pod containing a framework and resource bundle target for the Watch OS platform.

What did you expect to happen?

I expected it to be added to my project without any errors or warnings

What happened instead?

Xcode is displaying a warning that the Info.plist generated for the resource bundle by CocoaPods does not contain any device family values compatible with the watchOS platform. CocoaPods does properly generate the Info.plist file for the framework specified for this pod, but not the resource bundle plist. This is currently happening the DeviceGuru pod.

ProcessInfoPlistFile /Users/xxx-watchos/DeviceGuru/DeviceGuru.bundle/Info.plist xxx/Pods/Target\ Support\ Files/DeviceGuru/ResourceBundle-DeviceGuru-DeviceGuru-Info.plist (in target: DeviceGuru-DeviceGuru)
cd /xxx/Pods
builtin-infoPlistUtility /xxx/Pods/Target\ Support\ Files/DeviceGuru/ResourceBundle-DeviceGuru-DeviceGuru-Info.plist -producttype com.apple.product-type.bundle -expandbuildsettings -format binary -platform watchos -o /xxx/Library/Developer/Xcode/DerivedData/esfpxpymkdrnvncrhykmgjnlqtan/Build/Products/Debug\ xxx-watchos/DeviceGuru/DeviceGuru.bundle/Info.plist

warning: TARGETED_DEVICE_FAMILY value (1,2) does not contain any device family values compatible with the watchOS platform. Please add the value '4' to the TARGETED_DEVICE_FAMILY build setting to indicate that this target supports the 'watch' device family.

CocoaPods Environment

Stack

   CocoaPods : 1.7.5
        Ruby : ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
    RubyGems : 2.5.2.3
        Host : Mac OS X 10.14.5 (18F132)
       Xcode : 10.3 (10G8)
         Git : git version 2.20.1 (Apple Git-117)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : xxx - git@xxx:xxx/Specs.git @ ca23ccbb4a0948c0765af441509efa16f8b1bc87
               xxx-specs - git@xxx:xxx/Specs.git @ ca23ccbb4a0948c0765af441509efa16f8b1bc87
               master - https://github.com/CocoaPods/Specs.git @ d6854346a369cf80a4556cd9208e43d985d14a6e

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.3.1
cocoapods-try         : 1.1.0
slather               : 2.4.7

Podfile

source 'git@dexgithub01.xxx:xxx/Specs.git'

workspace 'XXX'
project 'Projects/XXX.xcodeproj', 'Debug OUS' => :debug, 'Release OUS' => :release, 'Debug OUS MMOL' => :debug, 'Release OUS MMOL' => :release
use_frameworks!

def test_pods
  pod 'OCMock', '3.4.2', :inhibit_warnings => true
  pod 'SimulatorStatusMagic', '2.2', :inhibit_warnings => true
end



abstract_target :app do
  platform :ios, '11.0'

...
  
  abstract_target :main_app do
...
    pod 'DeviceGuru', '5.1.4', :inhibit_warnings => true

    target 'XXX-Enterprise' do
      inherit! :complete

      # Enterprise-only pods
      pod 'SwiftLint', '0.33.0', :inhibit_warnings => true

      target 'ScreenCrawler' do
        inherit! :complete

        test_pods
      end

      target 'MarketingUITests' do
          inherit! :search_paths

          test_pods
      end

      target 'XXX-Server-Tests' do
          inherit! :search_paths

          test_pods
      end
    end

    target 'XXX-Store' do
      inherit! :complete
    end
  end


end

abstract_target :watch_app do
  platform :watchos, '4.3'
  
  abstract_target :watch_extension do
    pod 'DeviceGuru', '5.1.4', :inhibit_warnings => true
    
    target 'Watch Extension - Enterprise' do
      inherit! :complete
    end

    target 'Watch Extension - Store' do
      inherit! :complete
    end 
  end

  target 'Watch - Enterprise' do
    inherit! :complete
  end

  target 'Watch - Store' do
    inherit! :complete
  end
end

post_install do |installer|  
  installer.pods_project.targets.each do |target|  
    target.build_configurations.each do |config|  
      if config.build_settings['SDKROOT'] == 'watchos'  
        config.build_settings['WATCHOS_DEPLOYMENT_TARGET'] = '4.3'
      end  
    end  
  end
end
@dnkoutso
Copy link
Contributor

dnkoutso commented Aug 1, 2019

Probably something we can fix yes.

Start here: https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb#L533-L537

Code already had a comment for it but things may have changed here. Is it a watchOS extension or app?

@Spilly
Copy link
Contributor Author

Spilly commented Aug 1, 2019

We are including this pod in the extension target.

@Spilly
Copy link
Contributor Author

Spilly commented Aug 1, 2019

I could create a PR but I'm not sure if we should append the device family to support watch or replace with simply the watch device family. The 'right' solution to me would be to only have the watch device family, but maybe these resource bundles get copied from the phone to the watch and need to support all three?

@dnkoutso
Copy link
Contributor

dnkoutso commented Aug 1, 2019

Havent investigated much myself but best rubrik is to immitate what Xcode 10.2 does. I.e do the same without CocoaPods in Xcode and see what it sets it to. Then we can change it here.

@Spilly
Copy link
Contributor Author

Spilly commented Aug 2, 2019

I assume you mean 10.3 now? I'll try to take a look today or early next week.

@dnkoutso
Copy link
Contributor

dnkoutso commented Aug 2, 2019

Yea thats fine 10.3, latest stable release, not Xcode 11 beta.

@Spilly
Copy link
Contributor Author

Spilly commented Aug 5, 2019

This is what I see when I create a resource bundle, change the base sdk to watch os and compile with Xcode 10.3. It sets the UIDeviceFamily to 4, but if you look at the targeted device family in Xcode it does not automatically set that at all. For the framework that contains the device bundle, it's targeted device family is also only set to 4. The safest change is to just add the watch device target family to the existing array.

Screen Shot 2019-08-05 at 2 26 09 PM

Screen Shot 2019-08-05 at 2 29 14 PM

Screen Shot 2019-08-05 at 2 29 21 PM

@Spilly
Copy link
Contributor Author

Spilly commented Aug 7, 2019

Ok, I've create a branch with the fix, but don't have push permissions. How do I submit a PR?

@dnkoutso
Copy link
Contributor

dnkoutso commented Aug 7, 2019

Fork the repo and make a PR between the two repos

@dnkoutso dnkoutso added this to the 1.8.0 milestone Aug 8, 2019
@dnkoutso dnkoutso closed this as completed Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants