簡體   English   中英

AppDelegate.swift中沒有此類模塊“ AWSMobileClient”錯誤

[英]No such module 'AWSMobileClient' error inside AppDelegate.swift

我正在嘗試將AWS框架與本機應用程序鏈接。 我正在使用cocoapods,並且已經在Podfile包含並安裝了所需的依賴Podfile

platform :ios, '9.0'
use_frameworks!

target 'auth' do

    inherit! :search_paths

    pod 'AWSMobileClient'
    pod 'AWSUserPoolsSignIn'
    pod 'AWSAuthUI'
  # Pods for auth

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

end

target 'auth-tvOS' do

  # use_frameworks!

  # Pods for auth-tvOS

  target 'auth-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

這時,當我在AppDelegate.swift文件中import AWSMobileClient ,收到此錯誤。

No such module 'AWSMobileClient'

當我有其他不會產生任何錯誤的AWS框架時,我不確定是什么導致了此錯誤。 這也可能解釋了為什么在xcode中運行時,應用程序構建會不斷失敗。 有什么想法嗎?

我正在將Xcode 9.2與Swift 3.2一起使用。 起初,我將在AppDelegate.swift文件中收到相同的“沒有此類模塊'AWSMobileClient'”錯誤。

我的解決方案:

  1. 確保打開.xcworkspace文件
  2. 在項目設置中,進入構建階段並添加適當的框架。 我添加了所有AWS框架,並且對我有用。 這是構建階段設置的屏幕截圖

安裝Pod之后,您需要打開.xcworkspace。您無法從.xcodeproj訪問它們

是Xcode項目和Xcode Workspace之間差異的很好總結。

除了@Stephen Kwan我上方的答案[ https://stackoverflow.com/a/48572298/3941896]

我的問題是當我在Podfile中復制並粘貼了冗余目標時。 它看起來像這樣:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target :'RM1' do
    use_frameworks!
    # other pods
    pod 'AWSMobileClient', '~> 2.6.6'
end

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

  # Pods for RM1

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

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

end

一旦我組合了兩個target: 'RM1' ,運行pod install就可以了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM