Arron J. Linton
Arron J. Linton

Reputation: 691

No such module 'AWSMobileClient' error inside AppDelegate.swift

I'm trying to link aws frameworks with a native app. I'm using cocoapods and I have included and installed the dependencies I'll need as such inside my 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

At this time, when I import AWSMobileClient in my AppDelegate.swift file I received this error.

No such module 'AWSMobileClient'

I'm not sure what's causing this error when yet I have other AWS frameworks that do not yield any error. This might also explain why the app build keeps failing when ran in xcode. Any thoughts on this?

Upvotes: 3

Views: 4080

Answers (3)

Idan Buberman
Idan Buberman

Reputation: 69

On top of the answer above me of @Stephen Kwan [https://stackoverflow.com/a/48572298/3941896]

My problem was when I copied+pasted redundant target in the podfile. it looked like this:

# 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

Once I combined the 2 target: 'RM1', run pod install and it worked.

Upvotes: 0

Stephen Kwan
Stephen Kwan

Reputation: 21

I am using Xcode 9.2, with Swift 3.2. At first I would gain the same "No such module 'AWSMobileClient'" error in AppDelegate.swift file.

My Solution:

  1. Be sure to open the .xcworkspace file
  2. In your project settings go to the build phase and add the proper frameworks. I added all the AWS frameworks, and it worked for me. Here is a Screenshot of Build Phase Settings

Upvotes: 2

MMP
MMP

Reputation: 915

After installing the pods you need to open the .xcworkspace You cannot access them from your .xcodeproj

Here is a good summary of the difference between Xcode project and Xcode Workspace.

Upvotes: 0

Related Questions