UrbanAirship Cocoapods not working with use_frameworks - swift

So I have a bit of an issue here. I'm using SwiftyJSON which does not appear to work without the use_frameworks option, and I also have need of the UrbanAirship framework as well.
If I disable use_frameworks, I'm able to Import AirshipKit without incident in my AppDelegate. However SwiftyJSON then cacks and I'm not able to use that. The reverse is true however if I enable it.
Has anyone had any luck or found a solution how to have both a dynamic and static library with Cocoapods?
What should my bridging header look like for UrbanAirship -- if I'm even able to use one with use_frameworks enabled?
Thanks so much!
Current Podfile:
platform :ios, '8.0'
use_frameworks!
target 'MyProject' do
pod 'UrbanAirship-iOS-SDK'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
end

The documentation for the URbainAirship-iOS-SDK pod is very lacking. In fact it doesn't make any reference to the fact that the module name diverges from the official documentation (even though its in the official repo).
You have to import `UrbanAirship_iOS_SDK' and all should be well.

Related

SDWebImage for Swift, Blur effect is it possible?

I am using SDWebImage for Swift in my project and I am trying to add a Blur effect to an image following the advance usage example found here.
More specifically I am trying to declare a SDImageBlurTransformer but when I start typing the option doesn't come up.
Is an image blur effect possible using SDWebImage package?
Make sure your Podfile refers to version 5.0 of the project and run a pod update. I have the code completion coming up properly on a new project using version 5.0 of SDWebImage.
Here's my Podfile for reference:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'BlurImage' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
pod 'SDWebImage', '~> 5.0'
end

Using firebase framework within cocoa touch framework

I’m developing a framework where I need to use firebase internally.
I added firebase framework manually to my framework as cocoapods didn’t work.
Now, I’m able to build my framework and use it on my local system as expected. But it creates problem when I ship it to other devs and it fails with following errors.
I tried several ways like adding firebase.h in framework's header file. But none of the approaches are working.
Also, apart from this approach, I tried manually adding firebase to main app, where it gave the logs saying duplicate frameworks found.
What am I doing wrong in adding firebase to framework ?
I've already checked some of the related question such as This and this
I suspect, that after transferring the code into the other machine, owner does not runs
pod install
terminal command, so physically the framework does not exist.
I can confirm Aaron answer: be sure to specify a complete, correct path.
I usually avoid as the "evil" cocoaPods (getting worse and worse to use..)
so I downloaded the zip and added all the folder.
I specify ONLY "Framework search path" and "Header search path".
Library search path is empty.
note: as suggested by documentation, I added FireBase.h AND module.modulemap, TOO. (and set -objC flag, too)
Adding one or more search paths for the framework and header file will resolve the issue.
First de integrate pod after try with fresh.
pod 'Firebase'
pod 'Firebase/Storage'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Messaging'
CocoaPods 1.5.0 static library feature does not work with FirebaseAnalytics because of the non-modular headers in FirebaseAnalytics.h.
Reported at CocoaPods/CocoaPods#7542.
Workaround is a similar post_install step similar to this.
Because the fix is a breaking change, it is targeted for the next Firebase major release.

Cocoapods: Cannot load module 'Alamofire' as 'Alamofire'

Update: I solved the question. Please see my answer below (underneath the question and comments).
This question was marked as a duplicate, but it's different because it is a brand new error that I couldn't find through any searches.
I tried installing Alamofire into my XCode project.
As per their their tutorial, I installed cocoapods onto my system.
I then navigated to the folder of my existing xcode project in the terminal, and did:
pod init
I then edited the new pod file and added:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target 'RainyShinyCloudy' do
pod 'Alamofire', '~> 4.4'
end
Finally, I executed the command:
pod install
My terminal told me the install was successful.
But when I opened the .xcworkspace, made a new swift class and tried to import Alamofire, I got this error:
One possible reason could be that I had tried to install an earlier version of alamofire earlier, deleted it and then installed this.
But I really don't know how that could have mattered.
Thanks for any help you guys can give me.
Actually it failed because you were trying to import AlamoFire and not Alamofire. Imports are case sensitive.
Update: I posted an answer earlier that was wrong.
But now I actually figured it out.
I made a new project, went to the settings menu by clicking on the name of my app in the project explorer.
Then I went to Linked frameworks and libraries which is at the very bottom of the General tab.
I pressed that little + icon, selected Alamofire.framework. and set the status to required
Following this, cleaning and rebuilding the project made the error go away.

Using installed pod in swift project

I'm trying to create a swift program that uses sockets. In order to do that, I'm trying to use the SwiftSocket library by installing it using CocoaPods.
My Podfile is basic:
target 'socket' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for socket
pod 'SwiftSocket'
end
According to the installation guide of SwiftSocket, after installing the pod I should be able to use the TCPClient right away.
Still, I fail to use the class in my main.swift file as it doesn't find the class.
I've searched the web to see what I'm missing here, but all I found are guides on how to bridge Pods written in ObjectiveC but not on pods written in Swift.
Any help?
Thanks
EDIT: With jamshes reginahit suggestion, I've added SwiftSocket.framework to the Linked Frameworks and Libraries, in addition to the Pods_socket framework that was already present.
Now the build is successful, but I gut a runtime error of Thread1: signal SIGABRT with the payload:
yld: Library not loaded: #rpath/SwiftSocket.framework/Versions/A/SwiftSocket
Referenced from: /Users/jonathan/Library/Developer/Xcode/DerivedData/socket-buglawjxihebcabvcihcbdrtkcxt/Build/Products/Debug/socket
Reason: image not found
(lldb)
EDIT2: Something was funky with my Xcode. I've reinstalled it and now it seems to work fine. Thanks to everybody for the help. :)
I would like to comment, but I don't have enough reputation.
Anyway did you write something like:
import SwiftSocket
in the class where you need it? Also, did you open the project with the xcworkspace extension?
If nothing works try to clean and rebuild the project
Based on my checking of the SwiftSocket Library, it seems that what you did should be fine (it should be pod 'SwiftSocket' referring to "Installation" section), I assume that you missed to add :
import SwiftSocket
in your main.swift class.
And yes, they are not mentioning that in "Code examples" section because they -probably- assume that importing it in your .swift file should be obvious.
Once CocoaPods is finished installing, you need to start using the .xcworkspace instead of your .xcproject file. So close your project, open the workspace (same directory), and import SwiftSocket.
Your Podfile seems correct, after that, you need to launch a terminal from your project directory:
cd ~/Desktop/MyProject/
Then run: pod install command.
This will create a .xcworkspace file and a Pods directory.
Now you have to open the .xcworkspace file with Xcode.
Donc forget to import yout pod like this: import SwiftSocket
Also take a look at the CocoaPods documentation: https://guides.cocoapods.org/using/using-cocoapods.html

Parse Crash Reporting import with pods not working on Swift

I have update the Parse SDK to 1.6.0 through CocoaPods.
IT works seems I am able to use the Local Datastore. However when I try to enable ParseCrashReporting doing
ParseCrashReporting.enable()
But Xcode does not find ParseCrashReporting.
Anyone having the same issue ?
Thank you !
ParseCrashReporting is in its own cocoapod spec. Make sure you add pod 'ParseCrashReporting' to your Podfile. Then import the headers as #Lucas pointed out.
Reference: http://cocoapods.org/?q=parsecrashreporting
I had the same issue and you should download the new Parse sdk, that comes with the following frameworks:
Bolts.framework
Parse.framework
ParseCrashReporting.framework
ParseFacebookUtils.framework
ParseUI.framework
In order to work, you should add the SQLite 3.framework and libstdc++.6.dylib to your project too
Don't forget to add on your Bridging-Header.h:
#import <ParseCrashReporting/ParseCrashReporting.h>
I'll also point out that as #cojoj mentions here, you should include use_frameworks! at the top of your Podfile to take advantage of umbrella headers. This blogpost lays it out clearly. It worked for me in getting the Parse SDK set up with CocoaPods and Swift.