Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.2.1, Swift, Cocoapods] got "Could not build module 'Airbrake_iOS'" #58

Closed
hlung opened this issue May 9, 2015 · 14 comments
Closed

[4.2.1, Swift, Cocoapods] got "Could not build module 'Airbrake_iOS'" #58

hlung opened this issue May 9, 2015 · 14 comments

Comments

@hlung
Copy link

@hlung hlung commented May 9, 2015

My Podfile looks something like this (removed other Swift pods):

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks! # needed for some other pods that are written in Swift

target 'MyProject' do
pod 'Airbrake-iOS', '~> 4.2.1'
end

Then I followed the readme in order to use it in my Swift project. In my Bridging-Header.h, I add ...
#import <Airbrake_iOS/ABNotifier.h>
Then hit build. The problem is, I always get Could not build module 'Airbrake_iOS'.

I also tried this:
#import "ABNotifier.h"
But it says "ABNotifier.h" file not found.

So I add the source code directly to my project, comment out some code in GCAlertView.h to make it compile (detail at http://stackoverflow.com/a/30138540/467588). And it compiles fine.

There may be some issues with pod setup. Is anyone seeing this?

@hlung hlung changed the title [Swift, Cocoapods, airbrake-ios 4.2.1] got [Swift, Cocoapods, airbrake-ios 4.2.1] got "Could not build module 'Airbrake_iOS'" May 9, 2015
@hlung hlung changed the title [Swift, Cocoapods, airbrake-ios 4.2.1] got "Could not build module 'Airbrake_iOS'" [4.2.1, Swift, Cocoapods] got "Could not build module 'Airbrake_iOS'" May 9, 2015
@jocelynlih
Copy link
Contributor

@jocelynlih jocelynlih commented Oct 7, 2015

Fixed

@jocelynlih jocelynlih closed this Oct 7, 2015
@rwickliffe
Copy link

@rwickliffe rwickliffe commented Oct 9, 2015

I still receive Could not build module 'Airbrake_iOS'. when use_frameworks! is used in CocoaPods. I'm seeing 'CrashReporter/CrashReporter.h' file not found in ABCrashReport.h. If I change the import to the following it compiles successfully, but I'm not convinced that is correct:

#import "CrashReporter.h"

Also, regarding frameworks, there is another crash on launch that #63 should address.

@jocelynlih
Copy link
Contributor

@jocelynlih jocelynlih commented Oct 13, 2015

@rwickliffe we can't reproduce your bug. pod version 0.39.0 and Airbrake-iOS 4.2.2.
pod lib lint Airbrake-iOS.podspec did pass the validation as well.
If this issue still exist and it's related to framework build, maybe switch to the static library or source files will help.

@rwickliffe
Copy link

@rwickliffe rwickliffe commented Oct 13, 2015

I'm using the same versions and it is specific to frameworks in that I'm installing via CocoaPods with use_frameworks!. Has your testing been done in the same manner?

@jocelynlih
Copy link
Contributor

@jocelynlih jocelynlih commented Oct 13, 2015

@rwickliffe Thanks for pointing out this issue to us. This is indeed related to CocoaPods with framework by use_frameworks! adding to Podfile, we've got the same issue.
For now there are two steps to fix this issue.

  1. move Pods/Headers/Private/Airbrake-iOS/ABNotifier.h file to Pods/Headers/Public/Airbrake-iOS/ABNotifier.h
  2. move folder Pods/Headers/Public/Airbrake-iOS/CrashReporter/ to Pods/Headers/Private/Airbrake-iOS/CrashReporter/
    Let me know if this is working for you.
    Again, we will work on the podspec to improve the process when use_frameworks! is called.

@rwickliffe
Copy link

@rwickliffe rwickliffe commented Oct 20, 2015

@jocelynlih Sorry for the delay, I hadn't had a chance to get back to this. I've tried the steps you outlined and was not successful - I still receive the two errors mentioned above:
Could not build module 'Airbrake_iOS'.
'CrashReporter/CrashReporter.h' file not found

Also, this may be expected, but any time pod install is run those changes are reverted.

In testing this, I noticed that the latest release (currently 4.2.4) no longer includes the PLCrash*.h files in Airbrake-iOS-umbrella.h, so I can no longer simply #import "CrashReporter.h" to work around this issue. I believe this is because the 4.2.4 spec in CocoaPods is different than the tagged 4.2.4 spec in this repository. In CocoaPods, the following is still present in the spec, which I believe should have been reverted:
"public_header_files": "Airbrake/notifier/*.h",

https://github.com/CocoaPods/Specs/blob/master/Specs/Airbrake-iOS/4.2.4/Airbrake-iOS.podspec.json

@lucaFaverio
Copy link

@lucaFaverio lucaFaverio commented Jan 4, 2016

@jocelynlih I got the same problem as @rwickliffe I can confirm that the project doesn't build using !use_framework on 4.2.4. I've tried on a clean project with Xcode 7.2 and cocoa pods 0.39.0

@jocelynlih
Copy link
Contributor

@jocelynlih jocelynlih commented Jan 6, 2016

Thx @lucaFaverio I'm working on the new release to address this issue.

@kaluznyo
Copy link

@kaluznyo kaluznyo commented Apr 19, 2016

Why this issue was closed ? Stiil issue when I do import Airbrake_iOS

Pods/Airbrake-iOS/Airbrake/notifier/ABCrashReport.h:10:9: Include of non-modular header inside framework module 'Airbrake_iOS.ABCrashReport'
AppDelegate.swift:11:8: Could not build Objective-C module 'Airbrake_iOS'

@lucaFaverio
Copy link

@lucaFaverio lucaFaverio commented Jun 7, 2016

@jocelynlih this issue still exists with the latest release (4.2.5). Digging a bit I found out that the culprit seems to be this import
#import <CrashReporter/CrashReporter.h> in ABCrashReport.h
changing to #import "CrashReporter.h" allow me to build the module and got the import working in a swift project.
My pod directory is organized as follow:

Pods
|-Airbrake-IOS
___|- ABCrashReport.h
___|- CrashReporter.h
__|- ...

So it made sense to change the import.
I don't know what could be the impact of this, could you please check out and made a fix?.

@kyrylo kyrylo reopened this Jun 7, 2016
@jocelynlih
Copy link
Contributor

@jocelynlih jocelynlih commented Jun 7, 2016

@lucaFaverio thx for the details. will look into the issue.

@ricsantos
Copy link

@ricsantos ricsantos commented Nov 22, 2016

Is there any update on this issue? The current release, 4.2.6, doesn't build for me due to this.

@lucaFaverio 's fix in #58 (comment) solves this issue for me, and there don't appear to be any side affects introduced with this fix.

Not sure that its worthy of a PR, here is a commit for reference: Meeco@9fdb49b

aramark-pivotal pushed a commit to aramark-pivotal/airbrake-ios that referenced this issue Jun 2, 2017
Uses @Class in ABCrashReport.h to declare PLCrashReporter and PLCrashReport
without having to import the CrashReporter framework in the header file.
This resolves an issue in which client apps failed to import Airbrake_iOS
due to the CrashReporter framework being private.

See [Github issue airbrake#58](airbrake#58)
aramark-pivotal added a commit to aramark-pivotal/airbrake-ios that referenced this issue Jun 2, 2017
Uses @Class in ABCrashReport.h to declare PLCrashReporter and PLCrashReport
without having to import the CrashReporter framework in the header file.
This resolves an issue in which client apps failed to import Airbrake_iOS
due to the CrashReporter framework being private.

See [Github issue airbrake#58](airbrake#58)
@mcgoooo
Copy link

@mcgoooo mcgoooo commented Mar 19, 2018

to anyone that gets here and having trouble with swift, the setup airbrake for your swift application pull above has details on making a bridge file, that as well as making sure the header_search_paths where correct fixed the problems for us

@Cris-Burlamaqui
Copy link

@Cris-Burlamaqui Cris-Burlamaqui commented Jun 27, 2019

After I have my Podfile updated I started get this issue and even I trying to implement @lucaFaverio's steps, it didn't work at all for me.
I'm using Airbrake-iOS version 4.2.8 and my iOS development target is 11.

@destari destari closed this Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
10 participants