ios – app_spec that is used as AppHost for UI test_spec missing a Main Storyboard in Podspec file


I have a development pod with the following Podspec file:

Pod::Spec.new do |spec|
    spec.name="BitLabs"
    spec.version          = '3.1.15'
    spec.summary          = 'BitLabs - monetize your app with rewarded surveys.'
    spec.description      = 'BitLabs offers the opportunity to monetize your app with rewarded surveys easily.'
    spec.homepage="https://github.com/BitBurst-GmbH/bitlabs-ios-sdk"
    # s.screenshots="www.example.com/screenshots_1", 'www.example.com/screenshots_2'
    spec.license="Commercial"
    spec.author           = { 'BitBurst GmbH' => '[email protected]' }
    spec.source           = { :git => 'https://github.com/BitBurst-GmbH/bitlabs-ios-sdk.git', :tag => spec.version.to_s }
    # s.social_media_url="https://twitter.com/<TWITTER_USERNAME>"
    
    spec.swift_version = '5.0'
    spec.ios.deployment_target="11.0"
    spec.dependency 'Alamofire', '~> 5.5'
    
    spec.default_subspec="Core"
    
    spec.subspec 'Core' do |core|
        core.source_files="BitLabs/Classes/{Shared,Core}/**/*.swift"
        core.resources = ['BitLabs/Resources/{Shared,Core}/**/*.xib', 'BitLabs/Localizations/**/*.strings', 'BitLabs/Resources/{Shared,Core}/**/*.xcassets']
    end
    
    spec.subspec 'Unity' do |unity|
        unity.source_files="BitLabs/Classes/{Shared,Unity}/**/*.swift"
        unity.resources = ['BitLabs/Resources/Shared/**/*.xib', 'BitLabs/Localizations/**/*.strings', 'BitLabs/Resources/Shared/**/*.xcassets']
    end
    
    spec.app_spec 'AppHost' do |host|
        host.source_files="BitLabs/AppHost/**/*.{swift}"
        host.resources="BitLabs/AppHost/**/*.{xib,storyboard}"
    end
    
    spec.test_spec 'UnitTests' do |test_spec|
      test_spec.source_files="BitLabs/Tests/Unit\ Tests/*.swift"
      test_spec.dependency 'OHHTTPStubs/Swift'
    end
    
    spec.test_spec 'UITests' do |test_spec|
        test_spec.test_type = :ui
        
        test_spec.requires_app_host = true
        test_spec.app_host_name="BitLabs/AppHost"
        test_spec.dependency 'BitLabs/AppHost'
        
        test_spec.source_files="BitLabs/Tests/UI\ Tests/*.swift"
    end
end

If I run pod lib lint or pod spec lint, I get failure due to the UITests failing.

What I tried

  • I want to add a UI test_spec to my project. And thus, I added it as shown in the Podspec file above.
  • It appears that it needed an app host to run on. So, I created an app_spec as the AppHost.
  • The app_spec had a Launcher Storyboard but not a Main one, so I created a Main Storyboard and assigned it as main manually in the pod.xcproject file.

What I expected to happen

Running the test manually works fine. So, I expected that running pod lib lint or pod spec lint
would succeed.

What actually resulted

Both pod lib lint and pod spec lint fail for the same reason. The UI Tests are failing because the AppHost doesn’t a Main Storyboard

But how to assign the Main Storyboard from within the Podspec? Because I am assigning it manually in my project, but this isn’t enough for the Podspec.



Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img