ParseFacebookUtilsV4, Swift and CocoaPods: unresolved identifier - ios

I'm developing an iOS App using XCode 7.0 beta 4 (7A165t) and Swift 2.0 that use Parse, Facebook and Google Maps. This is my Podfile:
platform :ios, '8.0'
use_frameworks!
inhibit_all_warnings!
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
pod 'GoogleMaps'
pod 'Parse'
pod 'ParseFacebookUtilsV4'
pod 'SWRevealViewController'
I tried to follow the Parse guide (https://parse.com/docs/ios/guide#users-log-in-amp-sign-up) but I receive this error
error: use of unresolved identifier 'PFFacebookUtils'
This is my Bridging Header
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
#import <FBSDKShareKit/FBSDKShareKit.h>
#import <SWRevealViewController/SWRevealViewController.h>
#import <ParseFacebookUtilsV4/PFFacebookUtils.h>
#import <Parse/Parse.h>
#import <Bolts/Bolts.h>
Any suggestion?

Just import ParseFacebookUtilsV4 in your code
import ParseFacebookUtilsV4
this worked for me

Under your project's build settings, make sure that in Swift Compiler - Code Generation, your Objective-C Bridging Header path is set to yourProjectName/nameOfYourBridgingHeader.h

Related

Upgrade to FirebaseCrashlytics and 'No such module FirebaseCrashlytics'

I am trying to upgrade to FirebaseCrashlytics from Crashlytics. I am able to import Firebase but not FirebaseCrashlytics. Here is my podfile:
platform :ios, :deployment_target => "9.0"
def shared_pods
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
pod 'SVProgressHUD'
pod 'IGHTMLQuery'
pod 'OpenTok', '~> 2.16.3'
end
target 'MyApp' do
#use_frameworks!
shared_pods
end
I cannot uncomment use_frameworks! since it breaks other pods I am already using.
My bridging header:
#import "FirebaseCrashlytics/FirebaseCrashlytics.h"
#import "FirebaseCore/FirebaseCore.h"
This is what I am getting:
According to the firebase docs then you just have to import Firebase, not FirebaseCrashlytics.
https://firebase.google.com/docs/crashlytics/get-started?platform=ios
If you're using it as a Swift framework then make sure you add it to your target's Frameworks, Libraries, and Embedded Content

ParseFacebookUtilsV4 duplicate symbols for architecture armv7

I cannot compile my Xcode project, it has problems with duplicate ParseFacebookUtilsV4
this is my apple Mach-O Linker Error:
duplicate symbol _llvm.cmdline in:
/directory/Pods/ParseFacebookUtilsV4/libParseFacebookUtilsV4Lib.a(PFFacebookAuthenticationProvider.o)
/directory/Pods/ParseFacebookUtilsV4/libParseFacebookUtilsV4Lib.a(PFFacebookUtils.o)
duplicate symbol _llvm.embedded.module in:
/directory/Pods/ParseFacebookUtilsV4/libParseFacebookUtilsV4Lib.a(PFFacebookAuthenticationProvider.o)
/directory/Pods/ParseFacebookUtilsV4/libParseFacebookUtilsV4Lib.a(PFFacebookUtils.o)
ld: 2 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've imported ParseFacebookUtilsV4 with cocoapods, here is my Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
use_frameworks!
target 'ZZZ' do
pod 'Parse'
pod 'FBSDKCoreKit', '4.3.0'
pod 'FBSDKLoginKit', '4.3.0'
pod 'ParseFacebookUtilsV4'
end
target 'ZZZTests' do
end
And here is my bridging header:
#ifndef FarThings_FarThings_Bridging_Header_h
#define FarThings_FarThings_Bridging_Header_h
#import <Parse/Parse.h>
#import <ParseFacebookUtilsV4/PFFacebookUtilsV4.h>
#import "FBSDKCoreKit.h"
#import "FBSDKLoginKit.h"
#import <Bolts/BFTask.h>
#endif
I hit this before, In my case I upgrade from old version and here's how I fix it. (Main idea is cleanup everything before pod)
Remove all old Parse, Bolt and Facebook related (all .framework lookup path and embed .framework) until you end up with unknown class.
Remove all .framework form folder via finder.
Clean up your build folder by 'alt+clean' via Xcode.
Delete all Pod related include all Pod folder via finder.
try pod install one by one (or all at one if you feeling brave) until it look like this.
pod 'Parse'
pod 'ParseFacebookUtilsV4'
pod 'ParseCrashReporting'
and some other pod you need after that.
It work for me, just make sure you remove all related.
You can this pod with new project to prove this work before trying with real project.

Cannot find Objective-C pod on Swift

I have this pod on my project:
Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'AFNetworking'
pod 'Parse'
pod 'Fabric'
pod 'Crashlytics'
pod 'MagicalRecord'
pod 'Socket.IO-Client-Swift'
pod 'SDWebImage'
pod 'MBProgressHUD'
pod 'HexColors'
pod 'SWTableViewCell'
pod 'AKPickerView'
pod 'CRToast'
pod 'MTDates'
pod 'JazzHands'
Project-Bridging-Header
#import <JazzHands/IFTTTJazzHands.h>
#import <MTDates/NSDate+MTDates.h>
#import <MTDates/NSDateComponents+MTDates.h>
I can use any MTDates function at any Objective-C or Swift file.
And I can use any JazzHands function/class at any Objective-C file, but when I try to use it on Swift like this:
import UIKit
class GICalendarViewController: UIViewController{
var separatorFrameAnimation: IFTTTFrameAnimation!
I've got this error:
Use of undeclared type 'IFTTTFrameAnimation'
I've tried to add #objc tag on this class, and this doesn't work.
Any ideas why this is happening?
You use these libraries as frameworks (use_frameworks!). So you have to add
import JazzHands
in your source files. The same you do with Cocoa's frameworks like UIKit.

Headers not found when referencing CocoaPods project from Swift

I would like to include iOS-WebP as a pod to my Swift project.
The pod spec reads
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'iOS-WebP', '0.4'
In Swift, I use import iOS_WebP to use the library.
However, compilation fails with the relative header paths inside the library not resolving correctly:
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/.../Products/Debug-iphoneos/Pods/iOS_WebP.framework/Headers/Pods-iOS-WebP-umbrella.h"
^
/Users/.../Build/Products/Debug-iphoneos/Pods/iOS_WebP.framework/Headers/Pods-iOS-WebP-umbrella.h:3:9: note: in file included from /Users/.../Build/Products/Debug-iphoneos/Pods/iOS_WebP.framework/Headers/Pods-iOS-WebP-umbrella.h:3:
#import "UIImage+WebP.h"
^
/Users/.../Build/Products/Debug-iphoneos/Pods/iOS_WebP.framework/Headers/UIImage+WebP.h:10:9: error: 'WebP/decode.h' file not found
#import <WebP/decode.h>
^
/Users/...ViewController.swift:3:8: error: could not build Objective-C module 'iOS_WebP'
import iOS_WebP
^
Building the library standalone via the scheme switcher works fine, it's only the integration into the Swift project that fails.
Cleaning DerivedData did not help, and the .xcconfig properly references the library both in OTHER_CFLAGS and OTHER_LDFLAGS.
Update
It works if I remove use_frameworks! and include the library via the ObjC Bridging header. Is there a way to disable use_frameworks! for a single pod?
Update 2
With this pod file, it compiles.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
xcodeproj 'xxx'
target "Frameworks", :exclusive => true do
link_with "xxx"
use_frameworks!
pod ....
end
target "StaticLibraries", :exclusive => true do
link_with "xxx"
pod 'iOS-WebP', '0.4'
end
Problem is that now when I launch the app, it doesn't seem to find the frameworks:
dyld: Library not loaded: #rpath/XXX.framework/XXX
Referenced from: /private/var/mobile/Containers/Bundle/Application/...
Reason: image not found
(lldb)

RestKit.h not found - Installed via Cocoapods

I am calling an import in the PCH file:
Prefix.pch....
#import <RestKit.h>
Pod File......
platform :ios, :deployment_target => '7.0'
pod 'RestKit', '~> 0.23.3'
It says 'RestKit.h' not found
The pch file contains...:
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import <RestKit.h>
I am running cocoapods 0.37.1, and I verified the 'Link Binary With Libraries' match in the tutorial.

Resources