Could not build Objective-C module 'TwitterKit' - ios

I'm trying to install TwitterKit on my project via Fabric, but got stuck on this issue:
Could not build Objective-C module 'TwitterKit'
I'm using Swift and TwitterKit (2.2.0)
I've attempted to clean derived data, clean build folder already, doesn't work.
Attempted this solution as well, but didn't work for me:
https://twittercommunity.com/t/could-not-build-objective-c-module-twitterkit/49551
Here is the error:
Does anybody have a solution for this? Thanks a lot!

Had same problem yesterday. Add bridging header and inside import fabric and twitter. Worked like a charm

There's a slight chance that the deployment target value of the project's target is lower than that the TwitterKit supports.
In my case this was the problem. If the above solution does not work, you may check if the __IPHONE_OS_VERSION_MIN_REQUIRED value in TWTRKit.h is compatible with the target's settings.

Related

Cannot load module 'Snapkit' as 'Snapkit'

I've tried every way of installing 'Snapkit' but so far I'm not having much luck.
I'm using the following:-
Xcode 8.3.3
So far I've tried following all the documentation online to solve the issue, however it still isn't working. Including following the steps here.
The current error message is "Cannot load module 'Snapkit' as 'Snapkit".
Although previously the message was no such module 'Snapkit'.
Typo in case - SnapKit, not Snapkit.
import SnapKit
I had the same error recently. That's why I saw your question. I rebuilt and ran the app. After the build is finished it now recognizes SnapKit )). If you opened it through workspace and if the contents of the pod file are ok, then it should open. Try building the project and type SnapKit after it.
Please ensure if you're using Cocoapods as your dependency manager that you're loading the Xcode WorkSpace and not the project file. Otherwise try cleaning the project and rebuilding.

GoogleMaps not found

I am trying to use google maps in my ios app my Xcode ver is 7.2 and swift ver is 2.1.1. I simply add GoogleMaps in my pod file everything is fine i added frameworks and libs which are required to support Googlemaps all fine, i am following this tut and according to this i have to add a bridging header file to include
#import <GoogleMaps/GoogleMaps.h>. My app already have one bridging header file because i am using facebook login as well so i put the import statement in the same file and in 'others linker flag -ObjC' is already there so after few required settings in storyboard i compiled my proj but i am getting this error "GoogleMaps/GoogleMaps.h" not found. I have searched for it and tried almost all the suggested ways on Stackoverflow but hard luck nothing worked yet.I will be really grateful if anyone could suggest me what i am doing wrong here.
Make sure your pod install went smoothly.
According to the tutorial,
You should see output similar to the following:
Downloading dependencies
Installing GoogleMaps (1.10.4)
Using SwiftyJSON (2.3.0)
Generating Pods project
Integrating client project
try
#import "GoogleMaps.h"
in your bridging header file

Xcode debugger doesn't display variable information after installing CocoaPods Podfile

I just installed CocoaPods and added a pod to my project in Xcode so that I could use the Google Maps SDK for iOS, and now I'm not able to get types or values for any variables in the debugger console. The only way I can see a variable's value is through a print statement in the code.
I'm using Swift 2.0 in Xcode 7.0 beta, and I followed these instructions almost exactly to install the pod into my project: https://developers.google.com/maps/documentation/ios-sdk/start. The only thing I did differently was to change the second line in the Podspec from "platform :ios, '8.1'" to "platform :ios, '9.0'".
I looked at the answers to this similar question: Xcode debugger sometimes doesn't display variable values?, but I was already using a debug build, and I'm pretty sure my problem is related to CocoaPods, because everything was working fine before I added that to my project.
This is known issue, you can find more info and starred isuue here.
TL-DR - Quick workaround:
Add Objective-C bridging header file and add #import <GoogleMaps/GoogleMaps.h>"
Remove all "import GoogleMaps" from your swift files
PS: Tricky stuff - you have to remove all imports from your swift files - I have forgotten to remove the one and it causes this debug issue.
I hade the same problem dunno if you solved it but, for me this happened because googlemaps was causing too many errors. So the workaround is remove all your googlemaps import in the projekt and add an import to googlemaps in your bridging header instead.
Updating to version 1.10.21020.0 of Google Maps SDK for iOS fixed the problem.

Google/Analytics.h file not found when adding to AppDelegate

I am trying to integrate Google Analytics in my ios project using Cocoapods. However, after following this for the steps till adding configuration file to my project, when importing the Google/Analytics.h in AppDelegate I get error for file not found. Tried following things:
Added $(SRCROOT)/Pods/GoogleAnalytics to User Header Search Paths in Build Settings.
Added libGoogleAnalyticsServices.a to link binary with libraries in build phases.
Added -lGoogleAnalyticsServices in Other Linker Flags.
Don't really want to do 2 and 3 as they make it free from Cocoapods.
What exactly am I missing?
Swift 3
With version 3.17.0 (installed using pod 'GoogleAnalytics' in Podfile):
Open yourproject.xcworkspace instead of yourproject.xcodeproj
Use #import <GoogleAnalytics/GAI.h> in the bridging header file
Edit:
Per jeremy piednoel's comment you may also need
#import <GoogleAnalytics/GAIDictionaryBuilder.h>
#import <GoogleAnalytics/GAIFields.h>
Problems
The code examples on the official documentation suggest
installing 1.0.0. Which doesn't even have binaries compiled for
arm64.
There seem to be at least three separate pods related to
GA. GoogleAnalytics-iOS-SDK, GoogleAnalytics, Google/Analytics.
Solution
Add this to your Podfile: pod 'Google/Analytics' and then pod install.
That should work. Now you can simply import Google/Analytics.h as suggested in the docs:
#import <Google/Analytics.h>
Further Discussion
There were two sets of issues that I ran into:
When using the incorrect suggested pod version (1.0.0), was a 64-bit compatibility issue. (ld: symbol(s) not found for architecture arm64)
When using the other pods (GoogleAnalytics-iOS-SDK and GoogleAnalytics) I had complaints of a missing <Google/Analytics.h> header file. ("Google/Analytics.h" not found)
I found this gentleman's post on a mailing list which suggested the Google/Analytics pod with no version number. (pod 'Google/Analytics' as noted above.)
This is a bug in cocoapods.
you need to add $(SRCROOT)/Pods/Google and $(SRCROOT)/Pods/GoogleAnalytics with recursive option to your User Header Search Paths.
Then include the #import "Analytics.h" instead of #import
When you add $(SRCROOT)/Pods/GoogleAnalytics to User Header Search Paths in Build Settings, also select recursive option. It will allow your project to search in GoogleAnalytics and all of its sub-directories.
UPDATED:
I have tried the tutorial and it works fine without any extra step. My pod version is 0.35.0. When you create configuration file, remember to enable GoogleAnalytics service.
UPDATED:
As #RajatTalwar pointed out, you also need to add $(SRCROOT)/Pods/Google with recursive option. Then include the #import "Analytics.h" instead of #import
If anyone else out there is having an error with trying to #import <Google/Analytics.h>, and the other solutions online aren't helping you, you should read on.
I was having this problem and none of the solutions I found would fix it. Then I noticed that one of my targets worked while the other one did not (I had two in the same project), and I tried to track down what was the difference between the two targets.
I noticed that there was a difference in the project on the General tab under Deployment info, where the second target (the one which worked) had separate options for iPhone and iPad, but the first did not. Someone else online said that they received these two new options when they duplicated their target. My second target was also a duplicate of the first, originally.
To make a long story short, I found that if I duplicated my target that the duplicate now suddenly worked. Those separate iPhone and iPad options also magically appeared. So I guess my project target was non-standard and causing a problem, probably because this project was created a long time ago.
I then just deleted the original target and renamed the new one to be the same name, although there was some cleanup work required in the build settings related to the plist file (it made a copy.plist file).
Hope this helps someone.
Check if you have multiple targets, in this case add pod 'Google/Analytics' foreach target in you pod file:
def google_pods
pod 'Google/Analytics'
end
target 'target 1' do
google_pods
end
target 'target 2' do
google_pods
end
target 'target N' do
google_pods
end
Also my $0.02 to this, since it seems to be a never ending story. None of the suggestions above did help. I got this obscure message from pod install
[!] The `blabla [Release]` target overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-blabla/Pods-blabla.release.xcconfig'. This can lead to problems with the CocoaPods installation
Finally I inspected my project.pxbprojand found, that I had this entry:
HEADER_SEARCH_PATHS = "";`
Obviously this is treated as "defined", so I changed it to
HEADER_SEARCH_PATHS = "$(inherited)";
and boom - all the Google suggested includes work
#import <GoogleAnalytics/GAI.h>
#import <GoogleAnalytics/GAIDictionaryBuilder.h>
#import <GoogleAnalytics/GAIFields.h>
Run pod update
Clean Build Files
Run Project
remove valid archs from build settings

Cannot load underlying module for 'Charts'

I'm just getting started with the iOS charts library :
I followed all the steps described under 'Usage' on the main page (https://github.com/danielgindi/ios-charts):
I added a UIView and made it subclass LineChartView
--> in ViewController.swift: the line import Charts gives an error: Cannot load underlying module for 'Charts'
Why is that ?
Thank you !
It's possibly related to this issue too: https://github.com/Alamofire/Alamofire/issues/122
In short: Seems like there's a bug in Xcode 6.3.1, where new projects have problems when importing Embedded Frameworks. In such a case, you need to let the project build first, and then add the framework to the project.
Sounds like your project haven't added the framework successfully. I just started with ios-charts as well, and I followed the steps on github as well and it worked like a charm. What I did was to just drag the Charts.xcodeproj into my Project Navigator and it worked like a charm. If this doesn't work for you, however, make sure you are using iOS 8. If you are not, then you have to add the .swift-files to your project. If you are using iOS 8 and the approach still doesn't work, I'd try to install it using CocoaPods instead. I'm fairly new in CocoaPods so can't really help you there, but just google on how to install frameworks using CocoaPods and you should find what you seek.
Sorry if I wasn't of much help!
The answer comes a bit late, but what solved the problem for me was to clean my project by selecting the option Product > Clean from my status bar. Hope it might help someone else in case you solved the problem already.
After cleaning the product once I received this error. I then removed the framework from embedded binaries, cleaned the product, then added it once more to embedded libraries. I then built the product and retried the import statement. The import statement worked.
I had the same issue with KeychainAccess pod. Even though the pod was installed it use to throw an error
‘Cannot load underlying module for KeychainAccess’.
The fix that worked for me :
Uninstall the pod and install it again
Delete the derived data content
Quit Xcode and start again
Make sure your scheme is targeting an iOS device or simulator. If you build for your Mac it'll give you this error.
Build the project and this error will go away

Resources