2

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?

Arron J. Linton
  • 493
  • 1
  • 9
  • 24
  • Did the pod install successfully? Are you sure you are opening .xcworkspace not .xcodeproj in the IDE? – Mahbub Morshed Jan 04 '18 at 09:24
  • 1
    AWSMobileClient sdk is written in objective C. First you should add it to bridging header and than use it. – Pardeep Bishnoi Jan 04 '18 at 09:35
  • @MahbubMorshedProttoy - Yea pod installed successfully. I just realized I was working in .xcodeproj in the IDE. Probably missed that note in the documentation. Any reason in particular I should have opened .xcworkspace ? – Arron J. Linton Jan 04 '18 at 10:15
  • After installing pods you have to open .xcworkspace not .xcodeproj to have access the pods. The pods are placed inside the workspace. – Mahbub Morshed Jan 04 '18 at 10:18
  • @ArronJ.Linton Do you want me to add my previous comment as an Answer so that you can accept it? – Mahbub Morshed Jan 04 '18 at 10:21
  • @PardeepBishnoi - Oh right that makes sense. I'll throw that in, see if it works. Do you have any resources that explain this in further detail ? – Arron J. Linton Jan 04 '18 at 10:28
  • @ArronJ.Linton Actually if you use use_frameworks! you won't need a bridging header. In this case you are fine as user_framworks is enabled. – Mahbub Morshed Jan 04 '18 at 10:31

3 Answers3

2

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
0

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.

Mahbub Morshed
  • 869
  • 8
  • 18
0

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.