Issue with building project after addition of AFNetworking in Xcode 8 - ios

I just added AFNetworking in my project and have this problem.If you will say that I need to add a security.framework I will answer that I did it already.Here is screenshots. Problem screenshot
I have already added framework screenshot

On screenshot I see that you added Apple Security.framework, and problem is with AFNetworking framework. Are you sure that you added AFNetworking to your project. If it was also added - then next question comes:
Was CocoaPods used for this, or there was another source. CocoaPods should install newest version of framework but if framework is for example copied from older project - then it can cause many issues. For example framework may not support arm64 architecture.
So first attempt to solve this problem will be using fresh version of framework (using CocoaPods recommended), eventually check architectures supported by framework (see here).

Clean your build folder and run pod install.

Related

cannot build project with xcode 8 beta 6

I am getting following error after I add a library via carthage -
library name compiled with older version of Swift language (2.0)
than previous files (3.0) for architecture x86_64
I have tried it with Argo library. (https://github.com/thoughtbot/Argo)
I have selected the correct xcode version using xcode-select utility.
What could be the problem? Any help is greatly appreciated
Thanks!
From what I learned, looks like you can't have libraries written in different versions of Swift.
In my Obj-C project I had 2 libs installed with CocoaPods
I updated the first one using the swift3 branch on github, and I converted the second one with Xcode.
Everything is building properly now!
This is happening as you've included another library (via cocoa pods or by linking the library directly etc...) which is compiled (or being compiled) in swift 2.
I've seen this a lot with Cocoapods (and Carthage)

Why am I getting an error regarding Bolts framework and FacebookSDK when I'm not even using Bolts?

Getting this error
framework not found Bolts for architecture x86_64
Followed Facebook's guide word for word, but the only place I can think of an error with linking happening is in the Build Settings for Framework Search Paths. All I currently am attempting in the app is to add a Facebook Login in button, simply visually to make sure it's loading visually. No method functionality is added, but I can't even build the project in this current state.
Open the project in Xcode.
Go to where you extracted the FacebookSDK. If you're using Mac OSX,
it should be available in Documents/FacebookSDK.
Grab the
Bolts.framework file and drop into your Frameworks folder in
Xcode for your project.
It should build now.
you need to add Bolts.framework to your project
As of 24th of April 2019, the Facebook SDK in Swift repo inside this commit:
Removed Bolts from Swift SDK
So you will have to add Bolts to your pod file.
FYI if you're using Swift 5 you will need to use the Bolts in Objc because currently Bolts for Swift only support Swift 4.1.
For Swift 5 in your pod file:
pod 'Bolts'
To answer your question, from Bolts GitHub:
Bolts is a collection of low-level libraries designed to make
developing mobile apps easier. Bolts was designed by Parse and
Facebook for our own internal use
EDIT / UPDATE:
It looks like Bolts for Swift now support Swift 5.
In my case I opened the project instead of the workspace (using pods)
Go to Build Settings of your project.
Search for Framework Search Paths.
Add to debug: "$(inherited)".
Do the same for release.
Re-build the project.
Hope it helps!
You can just do pod update and then open your xcworkspace. Fixed it for me.
Late but might help
- add Bolts.Framework
- also remember to do as warnings shown during installation
Run "pod update" in terminal (if you not updated)
Remove "Bolts" framework from "Other Linker Flags" (Click on target->Build Settings -> Other Linker Flags)

Embedding frameworks inside closed-source Swift framework

Our company wants to distribute a closed-source SDK for iOS to our clients. I've been using Cocoapods to build the framework and built an example app making use of it. Previously the app worked fine on the simulator as well as when deployed on the device. However, I was also embedding the Pods.framework file in the app itself. One other piece of information that may be of interest is that the framework is written in Swift, the included cocoapods dependencies are both Swift and Objective-C.
I wanted to make the pods requirements easier to manage so the user doesn't need to be concerned with them and tried to embed the Pods.framework file inside of the SDK we're building - so I removed the steps to Embed Pods Frameworks and Copy Pods Resources from the example app, leaving them only in the framework, I also removed Pods.framework as a dependency of the example app, leaving it only in the SDK. This seemed to work in the simulator, but the app now crashes on mobile device with dyld: Library not loaded error.
Upon researching it, I stumbled into a few related discussions:
https://github.com/CocoaPods/CocoaPods/issues/344 https://objectpartners.com/2014/06/25/developing-private-in-house-libraries-with-cocoapods/
However, the suggested solution of using private pods does not look like it would work for us, it's my understanding that the source code in the private pod would still be open, and we can't share it with our clients.
Could someone advise on a solution that would work in this case?
OK, I finally have a more durable solution. It's a modified, cleaner version of my old one now that I understand how Xcode links in my Swift sub-frameworks better
Problem that makes distribution/compilation a bit ugly:
Since Swift standard libraries aren't bundled on the device like Obj-C, nor are they guaranteed to be stable between versions yet (stable binary interface promised in Swift 3: https://github.com/apple/swift-evolution#development-major-version--swift-30) we have to make sure the entire project is compiled against the same version of Swift. That means the guy using your closed-source framework has to be using the same version of Swift in their Xcode for their project as you did for compiling the library, even if he's not using Swift in his code because ultimately it's his version of Swift that gets bundled into the app and your SDK runs against. This is only an issue for closed-source frameworks because open-source ones will always be compiled against the same version as final project. Possible workaround is to restrict clients to same version you use or distribute multiple compilations (i.e. Swift 2.1 and Swift 2.0). To remedy this, you could provide users with copies of binaries compiled against multiple versions of Swift.
Aside from that, here is what I had to do during compilation/distribution to make a binary framework that works in Swift:
When building the framework:
In project target, make sure to add Pods.framework to Linked Frameworks and Libraries (make sure this is a pre-compiled RED version of Pods.framework, I had a black compiled Pods.framework in the same directory which built fine but then resulted in a framework that would cause the project to complain about missing armv7 architecture during linker phase in later project)
In Build Settings, under User-Defined section, add a field called BITCODE_GENERATION_MODE and set it to bitcode
DO NOT #import any frameworks in your bridging header, all instructions telling you to do that are leftover from Swift 1.0-1.2 days, you don't need it anymore and it does more harm than good (the later project will complain that it can't find these headers that aren't even exposed to it)
Change build target to Generic iOS Device, Archive and Export the framework
When building the project using the framework:
Drag and drop the framework into the project, in General tab add it to Embedded Binaries and Linked Frameworks and Libraries (you only need to add the framework itself, not the sub-frameworks or the pods file)
In Build Settings tab, add a new path to Framework Search Paths: $(PROJECT_DIR)/MyFramework.framework/Frameworks
Build the project

Can't archive project when use new MagicalRrecord

I add to my project MagicalRecord as submodule as described here
https://github.com/magicalpanda/MagicalRecord/blob/master/Docs/Installing-MagicalRecord.md
Then i add it's to my project and i got modified content on submodule.
Just then i open my project.
Why? And also i can't archive my project, because can't found
I added MagicalRecord frame work to Link libraries but it's red
But it's build and run on simulator or iphone device.
Problem just then try make archive my app.
I would highly recommend using the CocoaPods method. I have used it for MagicalRecord many times with no issues. Relatively easy to install and keeps your code up to date.
I also ran into a similar issue when I tried a submodule and couldn't get it to work. Make sure your project has CoreData.framework linked and also trying linking libMagicalRecord.dylib and libMagicalRecord.a.

How to use cocoapods in an exist ios project

I have an ios project first made in Xcode4.6. I have update it to Xcode5.0.2. Now I want to change the project to using cocoapods to manage the third party pods.
Due to a newer to cocoapods.I search the Internet to how to install cocoapods and so on.Now it's OK.So I run the pod install to get "AFFnetworking 2.1.0". .xcworkspace generate successfully.Then I open the workspace.I saw this in the navigation
There are many question mark.I think this means that Xcode5.0.2 didn't know the AFNetworking 2.1.0 added by cocoapods. And If I write the "#import "AFNetworking.h" in a .m file. Xcode will say that can't find the "AFNetworking.h".
I am a newer to cocoapods. So home someone could help me. Tanks a lot.
Because AFNetworking is linked as a library you need to use the < > import style. So #import <AFNetworking/AFNetworking.h>.
The question marks are coming from your version-control system, not from Xcode itself; they indicate that the files added by CocoaPods are new to version control. I’d recommend committing all of the CocoaPods-related files right away so that you have just one commit that represents “moving to CocoaPods”.
I guess you are using git repository.Add files pod to repository, currently they are untracked thats the reason for '?' there.if the error persists then see the following discussion
AFNetworking Cause Error while using XCTest in Xcode5

Resources