Xcode does not see framework installed via cocoa pods - swift

I am trying to add the SharkORM framework to my application but somehow after installing pod which looks like :
target 'XXX' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for XXX
pod 'Firebase/Core'
pod 'SharkORM'
target 'XXXTests' do
inherit! :search_paths
# Pods for testing
end
target 'XXXUITests' do
inherit! :search_paths
# Pods for testing
end
end
and using command pod install; getting this :
Analyzing dependencies
Downloading dependencies
Using Firebase (3.12.0)
Using FirebaseAnalytics (3.6.0)
Using FirebaseCore (3.4.7)
Using FirebaseInstanceID (1.0.8)
Using GoogleInterchangeUtilities (1.2.2)
Using GoogleSymbolUtilities (1.1.2)
Using GoogleToolboxForMac (2.1.1)
Using SharkORM (2.1.1)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 2 dependencies from the Podfile and 8 total pods installed.
Which sounds great because the installation is succeed.
In the AppDelegate.swift getting error :
Use of undeclared type 'SRKDelegate' here :
class AppDelegate: UIResponder, UIApplicationDelegate, SRKDelegate {
I would say that i have to use import SharkORM on the top of my file but it does not shows me this file exist. It should - > Inside Pods file i have these components then what is going on ? As u can see I am using Firebase which is working.
Thanks in advance!

Install the framework
pod install
Open your workspace XXX.xcodeproj and create a bridging header. To create bridging header
//File -> New File -> Header File
//Save it as a YourApp-Bridging-Header
Compile the SharkORM framework target
Then include the framework header within your app, by adding this to the bridging header
#include <SharkORM/SharkORM.h>
import module import SharkORM in AppDelegate class
import SharkORM››
Add SRKDelegate in AppDelegate class
class AppDelegate: UIResponder, UIApplicationDelegate, SRKDelegate

You have to import SharkORM to use the pod. Also, make sure you're working on the .xcworkspace file in the same directory as the project (it's automatically created when you execute pod install.

Related

Swift Use of unresolved identifier 'RealmApp'

I was following this Realm ios SDK quickstart
https://docs.mongodb.com/realm/ios/quick-start/
here is my swift code
import Foundation
import SwiftUI
import RealmSwift
import UIKit
let app = RealmApp(id: "xxxx")
however i keep getting this error
Use of unresolved identifier 'RealmApp'
this is my pod file
# Uncomment the next line to define a global platform for your
project
platform :ios, '12.0'
target 'Emma' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for Emma
pod 'Firebase'
pod 'RealmSwift', '=10.0.0-beta.2'
target 'EmmaTests' do
inherit! :search_paths
# Pods for testing
end
target 'EmmaUITests' do
# Pods for testing
end
end
RealmSwift module has been installed through the pod file. I don't know how to resolve the issue since that is what is listed in the quick start.
I was getting the same error. At some point it seems let app = RealmApp(id: "xxxx") was changed to let app = App(id: "xxxx").

How to integrate FBSDKCoreKit into a Swift custom Framework?

Did anyone managed to integrate FBSDKCoreKit to a custom swift framework with cocoapods (or alternate method)?
When I do this (experiment 1):
target 'MyFramework' do
project 'MyFrameWork/MyFramework.xcodeproject'
pod 'FacebookSDK', :modular_headers => true
end
target 'MyApp' do
workspace 'MyWorkspace.xcworkspace'
project 'MyApp/MyApp.xcodeproj'
inherit! :complete
target :MyAppTests
target :MyAppUITests
end
I get No such module 'FBSDKCoreKit' when compiling the framework (same applies when setting modular_headers => false.
I have also tested use_frameworks! as follows: (experiment 2):
target 'MyFramework' do
project 'MyFrameWork/MyFramework.xcodeproject'
use_frameworks!
pod 'FacebookSDK'
end
target 'MyApp' do
workspace 'MyWorkspace.xcworkspace'
project 'MyApp/MyApp.xcodeproj'
inherit! :complete
target :MyAppTests
target :MyAppUITests
end
But then I get this error:
dyld: Library not loaded: #rpath/Bolts.framework/Bolts
Referenced from: /private/var/containers/Bundle/Application/***/MyApp.app/Frameworks/MyFramework.framework/MyFramework
Reason: image not found`.
Note: When I add the FacebookSDK to MyApp (with use_frameworks!) it works, but then, I can't make use of it from within MyFramework (hence useless to me).
I finally found another way to do that, so I dropped Cocoapods.
I stumbled upon the fact that Facebook publishes a Swift package (https://swiftpackageregistry.com/facebook/facebook-ios-sdk).
So I proceeded as follows:
removed pod 'FacebookSDK' from my pod file;
added the above mentioned package for my framework.
And voila!

No such module 'InputBarAccessoryView'

Trying to get MessageKit setup within my project. I'm getting the following error - 'No such module 'InputBarAccessoryView' within the
MessagesViewController+Keyboard.swift:26:8: No such module 'InputBarAccessoryView'
I've tried installing pods, updating pods and deintegrating.
import Foundation
import InputBarAccessoryView
Should compile normally. Only error that persists.
In My case i will update pod file Ios version
# Uncomment the next line to define a global platform for your project
platform :ios, '14.0'
target 'Messanger' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for Messanger
pod 'InputBarAccessoryView'
end

Header 'MessageKit-Swift.h' not found

I'm trying to setup MessageKit within my app. I've been researching and trying to resolve this for a week with no luck. I'm getting an error in the module.modulemap file saying
Header 'MessageKit-Swift.h' not found
I'm deleted dervied data, ran pod update, pod install, etc.
Here is the module.modulemap code
framework module MessageKit {
umbrella header "MessageKit.h"
export *
module * { export * }
}
module MessageKit.Swift {
header "MessageKit-Swift.h"
requires objc
}
I expected MessageKit to compile within my workspace.
I tried that pod in a test project and compiles fine without issues.
I'm using Cocoapods 1.7.2 and Xcode 10.2.1, and this is my Podfile:
target 'MessageKitTest' do
use_frameworks!
pod 'MessageKit'
end
Tried to compile the MessageKitTest from the generated xcworkspace - all good on my end.
Try running a pod deintegrate then a pod install again.

Cannot import frameworks on new swift files when using cocoapods

Here is my podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'App' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Fabric'
pod 'Crashlytics'
pod 'Firebase/Database'
# Pods for App
target 'AppTests' do
inherit! :search_paths
# Pods for testing
end
target 'AppUITests' do
inherit! :search_paths
# Pods for testing
end
end
I then run pod install. I open the pods workspace as per usual.
Now in my AppDelegate.swift I can import frameworks without issue
import UIKit
import CoreData
import Firebase
import FirebaseCore
import Fabric
import Crashlytics
In my ViewController.swift, I can again import frameworks without issue
import UIKit
import Firebase
import FirebaseAuth
import FirebaseDatabase
The issue is when I get to my new view controller, called HomeController.swift
import UIKit
import Firebase
import FirebaseAuth
import FirebaseDatabase
It cannot find the frameworks, however it builds and runs fine. Just annoying as I lose code completion issues and have error warnings.
Not sure why it works on two files but not the third, it also builds and runs fine so seems like IDE issue rather than actual code/framework reference issue
Just looking at tips to resolve
Check the target membership of this new file to see if has the same as 2 previous one.
Select the file -> File Inspector -> Target Membership