如何为iOS Extension定义pod文件

时间:2017-01-21 10:50:35

标签: ios cocoapods

当如下定义我的Podfile,然后使用我的扩展构建我的应用程序时,我在DKImagePickerController框架中出现了一个构建错误,其错误类似于:Error "'sharedApplication' is unavailable: not available on iOS (App Extension)...." when compiling after pod update

正如您所看到的,我没有在我的Podfile中的扩展目标中包含DKImagePickerController框架,所以我想知道我做错了什么?

Pending: (Failures listed here are expected and do not affect your suite's status)

1) opscode-account user association user not in org can be invited to the org by an admin when the inviting annot be accepted
 # Known failure: passes w/ 200 b/c no USAG cleanup performed for deleted user
 # ./spec/api/account/account_association_spec.rb:661

2) opscode-account user association user not in org can be invited to the org by an admin when the inviting a can't by accepted
 # Known failure: passes w/ 200 b/c no USAG or other group cleanup performed for deleted user
 # ./spec/api/account/account_association_spec.rb:670


Failures:

1) authenticate_user POST /authenticate_user with correct credentials superuser user returns 200 ("OK")
 Failure/Error:
   post(request_url, superuser, :payload => body).should look_like({
       :status => 200,
       :body_exact => response_body
     })

   Response should have HTTP status code 200 ('OK'), but it was actually 401 ('Unauthorized')
     Reponse Body: {"error":["Failed to authenticate: Username and password incorrect"]}
 # ./spec/api/authenticate_user_spec.rb:129:in `block (4 levels) in <top (required)>'

2) users /users/<name> endpoint PUT /users/<name> superuser authenticating after updates when password is uncs not been changed.
 Failure/Error:
   post(auth_url, superuser, :payload => { 'username' => username,
                                           'password' => password }).should look_like({
       :status => 200
   })

   Response should have HTTP status code 200 ('OK'), but it was actually 401 ('Unauthorized')
     Reponse Body: {"error":["Failed to authenticate: Username and password incorrect"]}
 # ./spec/api/user_spec.rb:873:in `block (7 levels) in <top (required)>'

Finished in 3 minutes 14.5 seconds (files took 17.5 seconds to load)
154 examples, 2 failures, 2 pending

Failed examples:

rspec ./spec/api/authenticate_user_spec.rb:128 # authenticate_user POST /authenticate_user with correct credent
rspec ./spec/api/user_spec.rb:871 # users /users/<name> endpoint PUT /users/<name> superuser authenticating aft modified user when password has not been changed.

更新

我很欣赏由于API不可用而导致错误,我想弄清楚的是如何避免它。我怀疑是在我的podfile上,因此我的问题是:)

2 个答案:

答案 0 :(得分:3)

我有同样的问题,所以对于其他人找到这个帖子,我能够通过创建两个顶级目标而不是使用嵌套目标来解决问题。

target 'MyApp' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for MyApp
  pod 'Eureka', '~> 3.0'
  pod 'ChameleonFramework', '~> 2.0'
  pod 'SharedPod', '~>1.0'

  target 'MyAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'MyAppUITests' do
    inherit! :search_paths
    # Pods for testing
  end
end

target 'MyApp Today' do
  use_frameworks!
  # inherit! :none
  # Pods for MyApp Today
  pod 'SharedPod', '~>1.0'
end

为了干净利落,我跑了......

pod deintegrate
-- Then cleaned out the project file in XCode
pod install

答案 1 :(得分:0)

很少有API在App Extension中无法使用。其中一个是UIApplication。框架开发人员必须确保永远不会发生这种情况。 https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/ExtensionOverview.html#//apple_ref/doc/uid/TP40014214-CH2-SW6