Question for someone who's quite fresh with PubNub and iOS-Swift,
as of today can you put PubNub in a project, entirely, absolutely not using cocoapods in any way? So, pure Carthage?
(PubNub's own doco is a little confused on the matter, at a quick glance.)
(Strictly iOS 10, no legacy)
Docs looks pretty clear about how to use Carthage way of integration.
To run this command you don't need CocoaPods (platform can be any: macos, tvos, ios and watchos or w/o platform to build all):
carthage update --platform ios
The only thing is required is Cartfile at the same directory from which you will call command from above. It should contain at leas this line (depending from version which you need):
github "pubnub/objective-c" ~> 4.1
As result you will get .framework bundle under Carthage/Build/{platform-name}/PubNub.framework. As mentioned in docs you can drag&drop it into your project and don't forget to add it to Embedded Binaries.
It looks like the project builds standalone frameworks, so you could add it as a Carthage dependency.
Carthage just downloads the project and builds it according to the project settings. All the consuming project needs to do is add the specific built product to you project.
Related
I am trying to implement integration of third party app into project as per instruciton https://github.com/Paytm-Payments/Paytm_iOS_App_Kit/tree/master/Swift/BitCodeDisabled/PaytmNativeSDK
I see the following error in build
Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0
compiler
I have tried toolchains https://medium.com/xcblog/switching-swift-versions-inside-xcode-using-toolchains-755b28831c43
The error changes to Reason: Incompatible library version: PaytmNativeSDK requires version 1.0.0 or later, but libswiftCore.dylib provides version 0.0.0
How do i setup XCode or the Library to make it work . There is no chance of the vendor updating the library for Swift 5.0 and make it available on POD.
For Carthage users: After upgrading to Xcode 10.2, I ran into this same issue with a framework that I had been importing using Carthage.
I resolved it by rebuilding the framework:
carthage update --no-use-binaries --platform iOS
The correct solution is download Xcode 10.1, and wait for Apple patch the bug fix.
Don't waste time on fix third-party bug.
The problem of my project is we are using Alamofire which is failed to update by Carthage.
The provider of this library should rebuild it with BUILD_LIBRARY_FOR_DISTRIBUTION = YES; (available in Xcode 11.3 in Build Settings -> Build Options). Already asked to do it in the corresponding GitHub issue. After that PaytmNativeSDK will be compatible with every next Swift version.
It looks like the issue has been fixed in 804152caae76245d96548eb74ea87a6150239407.
I wanted to use Swift 4.2 (which Xcode 10.2 should still support, I've set it in Swift Language Version), but it still gave me an error about the Swift 5.0 compiler. So after trying to clear everything like build folder, derived data and stuff, I came to the conclusion that it does not work on Xcode 10.2.
I reverted back to Xcode 10.1 which you can download here. This works. So until Apple fixes this bug I am forced to stay on Xcode 10.1.
The developers of the framework need to provide an update, which is built in Xcode 10.2.
Explanation for framework developers:
Even if you created the framework in Xcode 10.2 or with the default version used by CI, your users may still encounter such an error. You should make sure that Xcode 10.2 is your default command line tool. You can check it in terminal with the command xcodebuild -version.
Default version can be adjusted in Xcode -> Preferences -> Locations -> Command Line Tools.
This will happen if you have external libraries in your project thats still built using 4.2 compiler, whereas the new Xcode tries building your project in 5.0 compiler.
In my case, I had few libraries imported using Carthage. Luckily the libraries that I have used have released an updates in the past few days making it compatible with Swift 5.0 compilers. If those external libraries haven't updated it to support Swift 5.0 you may be out of luck for now.
On the way you might still face few issues and here are some best practices to avoid further issues.
Remove the cartfile.resolved and Carthage folder completely
Ensure you remove any copy of the libraries added to your project earlier.
Remove the embedded libraries and Linked frameworks and libraries from your Targets> Yourapp > General .
Product > Clean build folder
Update the Cart file and fetch the new sources using the Carthage update command
Now import the libraries back to your project.
Hopefully it works.
My problem with Carthage was related to the xcode phase that copys binaries in
"carthage copy-frameworks" phase.
I've a slightly different solution to the one commented in https://stackoverflow.com/a/55362536/721929, because that solution also updates dependencies versions in some cases.
So, I just executed "carthage build". I also include a cache clean for Carthage, to fix possible errors in subtasks (in my case, failing in git clone with "exit code 1")
rm -rf ~/Library/Caches/org.carthage.CarthageKit
carthage build --no-use-binaries --platform iOS --verbose
Just remove all the *.framework folders, fetch and generate then just Import the new framework folders to your project.
That's what helped me.
For Instance:
Please bear with me because I spent considerable amount of time on this. I am also relatively a beginner with swift and iOS.
What I did
- built a framework using cocoa touch
- clean, build and it succeeds without a problem.
- made the scheme shared
- did carthage build --no-skip-current
- did carthage archive
- copied only the zip file to a fresh new directory and uploaded with release in git.
- In a different project tried to pull the framework using carthage
and I get the error Dependency "xxx-ios" has no shared framework schemes then I copied the scheme directly and pushed it in the git along the zip. nothing. Tried without the zip together with the scheme. nothing.
Then I created a fresh framework and I did carthage build --no-skip-current and I uploaded the whole thing in the project folder to git. That pulls properly with carthage. Then I removed some part of that folder so that the scheme inside .xcodeproj and the carthage build folder remain, then I get a different error. At this point it got me thinking if carthage does support binary framework distribution.
In my company, they want it so that I don't expose the code - so I am trying to distribute built binary of the framework.
I would really appreciate any help or guides of what different things I could try to single out the problem. Thanks.
Edit
someone had almost exactly the same issue as mine in their issues here but a couple of conversations later it is closed without a solution.
It sounds like you're using a github dependency in your Cartfile and attaching a binary of your framework to the GitHub Release. But you don't have any code in the repository, so Carthage is complaining because it can't actually build it.
That's as designed—Carthage doesn't support distributing binary-only frameworks that way. Binaries attached to GitHub Releases are only meant as a way to speed up builds.
However, Carthage does have a mechanism for binary-only dependencies: binary dependencies.
There is a Swift project on GitHub that I want to include in my iOS app.
In my iOS app, I use Carthage. But the GitHub project is not compatible with Carthage (only with Cocoapods), so I need to include the .framework file in my project manually.
How can I generate the .framework file without Carthage?
Building the framework is not always the same across projects. That being said, there should be a target available when you open the project to make the framework build. It should look something like this.
After clicking run the framework is usually output to the products directory.
If this doesn't work for you with this project then maybe you could share a link to the github page for the project and I could provide more instruction.
Fork Project
Change scheme to shared in scheme management (more information on Carthage docs)
Add your fork to your Cartfile
You can stop here but I highly recommend do this after:
Update README with information about Carthage support
Make a pull request
I create a framework (called ProjectOne) built and tested it. I want to allow this framework to be used in Carthage. I edited my scheme and made the default "ProjectOne" scheme shared in XCODE. I did a carthage build and verified that the framework was build in Carthage/Build/iOS.
I then push to github and and create a release.
In another project, I'm using this framework. But, carthage reports "Dependency ProjectOne has no shared framework schemes for any of the platforms: iOS".
I'm pretty sure I shared the scheme in ProjectOne - does anyone know why this is happening?
The folks at Carthage helped me discover the issue - Xcode was not adding the schemes to git. Make sure that .xcodeproj/xcshareddata/xcschemes is added and pushed to github.
In my case the issue was due the way I've included repo url in my cartfile.
I changed it from:
github "https://...UICore.git" == 1.0.0
to
git "https://... UICore.git" "master"
Click on Manage Schemes, and then un-flag and re-flag the “Shared” voice near "YourFramework". Go to terminal and now :
carthage build --no-skip-current
For me this was missing. I played around with scheme and pushed to GitHub PiAnimation.xcodeproj/xcshareddata/xcschemes/PiAnimation.xcscheme
For me the problem was new version of Xcode. I've build project in newer Xcode version, but command line tool has been set to previous. To change it you should open Xcode -> Preferences -> Locations.
Im working on a music streaming iOS project and want to leverage the SoundCloud SDK.
I followed this guide to the tee:
https://developers.soundcloud.com/docs/api/ios-quickstart
The five SoundCloud dependencies are:
CocoaSoundCloudAPI
OAuth2Client
JSONKit
OHAttributedLabel
CocoaSoundCloudUI
All five of these projects are available as submodules that you simply add to your current git repository. According to the guide linked above, you are supposed to be able to add them and move on with your project. However, their architectures are all different! CocoaSOundCloudAPI, JSONKit, OHAttributedLabel and CocoaSoundCloudUI are all 32bit architecture projects, while OAuth2Client is a 64bit architecture project.
No matter what I build my project as, 32 or 64bit, I get a Mach-O linker error. I've added both 32bit and 64bit as Valid Architectures in my main Xcode Project, but the issue persists.
I have also not been able to find other versions of these submodules. I can't be the only one with this problem, as I have literally followed the guide word by word, yet I can't find any solution anywhere.
Please help me out!
I am using Xcode 6 and building for the iOS8 SDK.
Thanks!
Edit:
Here are screenshots of my architectures and the error...
I HIGHLY suggest using CocoaPods to manage this dependency. I once integrated SoundCloud into a project without using CocoaPods and it was a pain in the rear. Look at this link and do a search for CocoaPods to see how to install it: https://github.com/soundcloud/CocoaSoundCloudAPI
Here's something that helped me:
Go to the SmartSpeakers target (or whichever is the target for your app)
Build Settings -> Other Linker Flags
Add $(inherited)
Build it!
CocoaPods was the way to go for me. My Podfile looks like this:
pod 'CocoaSoundCloudAPI', '1.0.1'
pod 'CocoaSoundCloudUI', '1.0.5'
pod 'JSONKit', :podspec => 'https://gist.github.com/marcdown/5282955/raw/2a52cfd92f112f2a52669420c82c1bb1efd15d2a/JSONKit.podspec'
As of the time of this post, the podspec fetches version 1.6.0. I experienced problems with some deprecation issues in earlier versions of JSONKit. If one leaves out the pod for JSONKit, an earlier version that contains these issues is installed by Cocoapods.
I also had to disable ARC for the JSONKit pod in its Build Settings to silence ARC errors:
Pods-JSONKit -> Build Settings -> Apple LLVM 6.0 - Language - Objective C
This did it for me.
Are you trying to deploy to a 64-bit device? Try setting Build Active Architecture Only to NO under Targets -> Your App -> Build Settings -> Architectures.
EDIT: I followed the instructions and created a sample project that builds. I couldn't figure out exactly why you were getting that linker error, but maybe you can compare my project to yours.
http://lieberman.nyc/sample_soundcloud_project_for_relatively_slow_on_stackoverflow.zip