Aws-sdk-ios: Module 'Fabric' has no member named 'with'

Created on 3 Dec 2015  路  17Comments  路  Source: aws-amplify/aws-sdk-ios

Introduction of Fabric.h in the library doesn't allow using Fabric in the project which has both AWS and Fabric. Refer this link.

question

All 17 comments

We were not able to reproduce the issue. Can you show detailed steps to repro?

Hi Sahil,

I am a Fabric iOS dev. I am happy to help you and AWS team debug this issue.

I tried reproducing this as well, but could not. I used the Fabric Mac app to get the latest Fabric and Crashlytics pods in a new Pod workspace. And then running Fabric.with worked. Then I integrated AWSS3 latest pod to the workspace and added some dummy instructions to make sure AWSS3 is being used, and even then Fabric.with worked.
AppDelegate.h had this code: "
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.

    let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
    let configuration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialProvider)
    AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration
    print(AWSS3TransferManager.defaultS3TransferManager())

    Fabric.sharedSDK().debug = true
    Fabric.with([Crashlytics.self])
    return true
}

"

The fact that AWSCore embeds Fabric headers inside it should not be an issue. AWSCognito is a known Fabric Kit and that is why AWSCore(which AWSCognito depends upon) has Fabric headers inside it. Stripe and other known Fabric Kits have them too. This should ideally not interfere.

You have also mentioned yourself that this doesn't seem to be a problem for you in a dummy project. Do you have any clues on what could have been different in your app? Can you check and tell us which version of Fabric and crashlytics pods are inside your app? Or If it is possible, can you share relevant parts of your app code with us?

Cheers,
Priyanka

Note that I enabled Fabric logging above with "Fabric.sharedSDK().debug = true" before the Fabric.with call. Can you do that in your project, and lemme know what gets printed to the console when AWSS3 pod gives you the issue? We would love to help your problem get resolved, so that you can continue to use the latest and greatest pod versions of AWS.

Also, this is my sample project which is not giving me the bug. If you'd like please lemme know what if anything is different in my case -

AWSCrashlyticsFabricTester.zip

Also of interest to you might be the bridging header file, maybe see if your bridging header file for AWS had anything different than mine?

I can't reproduce the bug in your project.

My podfile

source 'https://github.com/CocoaPods/Specs'

platform :ios, '8.0'
use_frameworks!

# ignore all warnings from all pods
inhibit_all_warnings!

target 'MyProject' do

    # Crashlytics
    pod 'Fabric'
    pod 'Crashlytics'

    # AMAZON AWS
    pod 'AWSS3'

end

My application delegate is very similar to yours but when I use latest AWS3 pod, I get this error.
screen shot 2015-12-03 at 4 43 15 pm

Using pod 'AWSS3', :git => 'https://github.com/aws/aws-sdk-ios.git', :commit => '740ba6ecf34' fixes the problem.
I am using cocoapods frameworks. I just use import AWSS3, so bridging header is not required.

One thing I noticed right off is that your Podfile has "pod Fabric", notice the lack of single quotes around Fabric. This will make Fabric pod installation fail. I get this error from CocoaPods on using Fabric without single quotes:
[!] Invalid Podfile file: uninitialized constant Pod::Podfile::Fabric. Updating CocoaPods might fix the issue.

Was this just a copy-paste mistake here, or is this directly how your modified project podfile was? If this is how it was, then it makes sense that Fabric Pod was not installed and hence your Fabric module did not contain any members.

Also, I used "use_frameworks" now in my Podfile to make sure I am doing exactly what you are doing, but that still downloads AWSS3 and AWSCore as source headers. I don't see a framework for them, and "import AWSS3" doesn't work. I removed the bridging header. What am I missing?

Here's my modified Podfile:

platform :ios, '8.0'
use_frameworks!
target 'AWSCrashlyticsFabricTester' do
pod 'Fabric'
pod 'Crashlytics'
pod 'AWSS3'
end

And then I did "pod update", but still get the headers for AWS frameworks and import error like so:
screen shot 2015-12-04 at 11 48 01 am

@yosuke-matsuda Is it normal that I am not seeing AWSS3 and AWSCore pods as frameworks even when I use "use_frameworks!" in my podfile, and subsequently "import AWSS3" doesn't work in a Swift project? Or am I missing something?

Yeah, that was a copy/paste mistake. Fabric is installed, otherwise import Fabric would have been failing.
I am able to import AWSS3 in Swift without any error. I see AWS files in exactly the same way as you do. AWSCore.framework is in the Framework folder(in Pods) but is highlighted in red.

Okay, I was able to get the Swift imports for AWSS3 working. I created a new project, containing the latest AWSS3 pod and latest Fabric and crashlytics pods integrated via the Fabric Mac app. I am attaching this new workspace here. I have replaced my API_KEY and API_SECRET for Fabric by generic strings in the Run script build phase and Info.plist. The workspace won't run either until you replace the values in Run script by your project's values or worst case comment out the Run script(just for testing to know it works).

So, I am unable to reproduce your bug even though my setup looks exactly like yours to me. Lemme know if we can change anything in the workspace to reproduce the bug. Otherwise, we will close this as not reproducible. Thanks!

AWSPodTester.zip

Even I'm unable to reproduce the bug in new project. Seems to happen only in current project but can't find a reason why :(.
Thanks for your help. Will update if I find something.

Thanks Sahil, good luck in future projects.

I have exactly this problem using AWS and Fabric! Both using the latest version from cocoapods

@alexnaldo Yeahh.. I got the same problem too
I've fixed it downgrading AWS pod version to 2.3.0.

It occurs because Fabric is included in AWS lib in a wrong way.

My Podfile:

platform :ios, '8.0'
use_frameworks!

pod 'AFNetworking', '~> 3.0'
pod 'AWSS3', '2.3.0'

post_install do |installer|
  installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
    configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
  end
end

I've included Fabric.framewirk via Fabric.app wizard

I solved using this 'import' :

import Foundation
import AWSS3
import Crashlytics
import DigitsKit
import Fabric

It is a AWS problem because have Fabric class too.

@alexnaldo was right it was AWS problem.. I also downgrade my AWS version to 2.3.0
my podfile
pod 'Alamofire', '~> 3.2'
pod 'AlamofireObjectMapper', '~> 2.1'
pod 'AlamofireDomain', '~> 2.1'
pod 'AlamofireImage', '~> 2.3'
pod 'Fabric', '~> 1.6'
pod 'Crashlytics', '~> 3.7'
pod 'AWSS3', '2.3.0'

thnx @alexnaldo n @fernandodev

I'm having the same issue when using Fabric (1.6.7) and AWSKinesis (2.4.0) in the same project. I was able to work around it by adding import AWSCore to AppDelegate.swift where I initialize Fabric. Is there a fix in the works?

Was this page helpful?
0 / 5 - 0 ratings