Adding FacebookSDK - ios

I drag/drop facebooksdk.framework to my project(and i select copy items). I complete coded part and when i run my project it worked without any problem.
However when i close xCode and start xCode and run my project x code gives red error messages. Its;
"/Users/me/Desktop/xcode/swift/projects/projects/projects/projects-Bridging-Header.h:6:9: 'FacebookSDK/FacebookSDK.h' file not found"
and other one is;
"Failed to import bridging header '/Users/me/Desktop/xcode/swift/projects/projects/projects/projects-Bridging-Header.h'
The problem solved by re-added facebooksdk.framework file to my project. Did i have to always add this framework to my project(everytime i start this project xcode gives red errors)? Is there any way to fix that?
Thank you.

You need to import your facebooksdk.framework like this one inside projects-Bridging-Header.h
#import <FacebookSDK/FacebookSDK.h>

Related

Failed to remove "Info.plist" couldn't be removed

I have been trying to fix this a few days before. I was adding JSQMessagesViewController to my iOS project. Added the library manually by dragging and dropping the JSQMessagesViewController folder downloaded from Github. tried to add a Bridging header for jsqmessagesviewcontroller. tried to add
#import JSQMessagesViewController
#import JSQMessages.h
later then when I build the project I found this error message
error: failed to remove /Users/user/Library/Developer/Xcode/DerivedData/CHATAPP-gcvyuyhkvbxvnlfnrrbmaebxevhx/Build/Products/Debug-iphonesimulator/CHATAPP.app/Info.plist: “Info.plist” couldn’t be removed.
I tried searching but didn't help any... what went wrong? How Can I remove this error ? using swift 2.2 and xcode 7.2
I began experiencing this issue right after making a pod install with Fabric (that made some changes to Info.plist). Then I realized that there was two Info.plist references in my project.
To solve the problem I just removed one of them, cleaned my project (Cmd + Shift + K) and built it again.
Hope this helps.
I fixed the similar issue by removing info.plist from BuildPhases-> Copy bundle resources -> "info.plist"
remove error specific .plist file from "Copy bundle resources" (in my case info.plist in MGSwipeTableCell creating issue)
you may need to add the files to your project. While in XCode right click on your files and select "add files to project" navigate to your project folder and select JSQMessagesViewController files then build.
You may also want to clean your derived data if you press Command Option Shift K then build the project again.
Removed those manually added files from my Project then made a fresh install using Pod now I don't have that error.
i recommend to you use pod to your project or drag and drop only require files from JSQMessagesViewController
you should don't import another project completely.
conclusion :
use pod for using JSQMessagesViewController because it has some dependency

Swift class not being added in Objective-C based project

I am trying to add KSTokenView in my Objective-c based project. I am supporting iOS 7 and above so can’t use Cocoapods for Swift. I am manually adding folder of KSTokenView in my project, I have following statement in my class.
import "MyProject-Swift.h"
The file imported perfectly, but when I open that file in Xcode it doesn’t expose any class of KSTokenView.
I have cleaned the project multiple times, but no luck.
Thanks
Happens to me many time. Not sure what is the issue. But I fix it like this:
Step 1: Drag all files in KSTokenView in Xcode Project Navigator. Only files not complete folder.
Step 2: Xcode will ask add Bridging header file. Click Yes.
Step 3: Clean the project
Step 4: Now #import "MyProject-Swift.h"
Step 5: Enjoy :)
You can later remove the files from Xcode and drag the complete folder. It would still work.

Import of framework in swift bridging header not recognised upon archive

I import the Facebook AsyncDisplayKit framework into my app using the swift bridging header, like so:
#import <AsyncDisplayKit/AsyncDisplayKit.h>
It's always worked fine for building and running my app, but when I go to archive, it gives me an error:
import 'file not found'
Why might this not be recognized, upon archiving?
I always meet this kind of problem. I think you can try to check your file&folder hierarchy.
Such as you have a root folder named Project, as is often the case, there is another Project in your previous Project, the root folder.
And Checking the Objective-C Bridging Header in the Build Setting. Sometime error can occurred for Project/Project/Bridging-Header.h. And the error can be corrected by changing the definition as Project/Bridging-Header.h.
If the location of Bridging-Header.h is not matching with the definition in the Build Setting, the error like import file not found will occur.
I just tell your my solution for Bridging issue I already met, I hope it can help you.

Unable to correctly import framework into xcode project

I'm trying to add KKGridView to my project. I've followed thier description from github as best I can:
Create a new workspace in Xcode in the same directory as your existing *.xcodeproj.
Drag in your existing Xcode project
Locate your copy of KKGridView, drag KKGridView.xcodeproj into the
workspace so that it stays at the top of the hierarchy, just like
your original project.
In the Build Phases section of your original project, link your
project with libKKGridView.a.
Now, simply import KKGridView just like an Apple framework:
But libKKGridView appears in red in my project, and I am unable to import any of the code with
#import <KKGridView/KKGridView.h>
Any ideas?
Copy this file physically to your folder,and then add file to xcode from there.Drag and drop create this problem sometimes.
Hope this helps you.
You need to import the .h files as well

XCode "File Not Found" error

I am new to Xcode and i am working on a SoundBoard app. In my viewcontroller.m file, I typed in #import " (less than)AVFoundation/AVAudioPlayer.h", only to get the error "File not Found". I did add the AVFoundation.framework file though, so i don't understand why i am getting this error.
Help?
Your import statement should look like this
#import <AVFoundation/AVFoundation.h>
If you have declared it like this then you might have a problem with how you are adding the AVFoundation Library. In Xcode 4 you need to select the Project in the Project Navigator
Select the Build Phases tab and expand Link Binary With Libraries.
Click the + button and add AVFoundation.
Hopefully this corrects your issue otherwise its an issue with the Header Search Paths.
When you add your frameworks make sure you do not copy them to your project, just use them in their original locations. To find out where those frameworks are located right click on a framework and select "show in finder".
This has worked for me.

Resources