`#import "FBConnect.h"` vs. '#import "FBConnect/FBConnect.h" ' - iphone

It took me some time to get XCode to locate the Facebook sdk.
I added ‘....../facebook-ios-sdk/src ‘ into ‘Header Search Paths’ in ‘Project Settings’ (the ‘Header Search Paths’ in the ‘Target Info’ does not show the directory however) , and use:
#import "FBConnect.h" ,
instead of #import "FBConnect/FBConnect.h", then the XCode can locate the facebook sdk.
As the 'FBConnect.h' is directly under the /src, where is the 'FBConnect'? What does "FBConnect/FBConnect.h" mean? Do you guys use #import "FBConnect/FBConnect.h" without manually adding a 'FBConnect' directory or Group in XCode?

I also use #import "FBConnect/FBConnect.h" in my projects, but you don't need to add the Facebook iOS SDK to your search paths in Xcode. Xcode automatically adds paths for compilable files in your source tree to gcc's list of include paths. Groups in Xcode are only for your peace of mind and project organization -- they have absolutely no effect on your project's build settings. The use of FBConnect here refers to a subdirectory on the filesystem, not the actual group name in your project.
Keep in mind that there are actually two Facebook SDKs available for the iPhone: facebook-ios-sdk and facebook-iphone-sdk. I'm not 100% sure as to why, but I think that the facebook-iphone-sdk is being deprecated in favor of the new one. Since Facebook (for some odd reason) chose to put their header files in an additional subdirectory also named "FBConnect" underneath the main source directory in the facebook-iphone-sdk project, you need to add the additional FBConnect when importing this file. Also, you'll see a lot of examples referencing the old project code which uses this importing style as well.

Related

Setting up facebook login in swift

I have been trying to setup an facebook login in my app.
In the guide I'm following from facebook, it says I need to import this:
#import <FBSDKCoreKit/FBSDKCoreKit.h>
I have downloaded the IOS SDK folder which I took the Corekit folder and dragged it into my project in xcode, however when I create a objective c file and insert the line, it says:
"FBSDKCoreKit/FBSDKCoreKit.h file not found."
Did you check the "copy items if needed" checkbox ?
If you didn't you have to add framework search path in your project settings
First of all it is better to include header files to the bridging header and then use method by swift way (https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html).
Then I would prefer to install FB through cocoapods.
If you insist on your solution then check Header Serch Paths in project > Build Settings > Search Paths > Header Search Paths.

Header file for included static library not found by swift bridging header during archive

I've run into a very vexing problem.
I've included a 3rd party static library (PDFKitten) into my project, which is a mixture of Swift and Objective-C code. I can build & test just fine in simulator and device.
However, when trying to do an Archive build ready to submit to the app store, the Swift compiler complains that the header PDFKitten/PDFKitten.h cannot be found.
Reproducing this is easy:
Create an empty Swift iOS project in Xcode.
Grab the PDF Kitten project and add it as a sub project.
Add the PDFKitten lib as a dependency
Create an objective-c source file to force the creation of the bridging header. Once the bridging header is created, you can delete the empty objective-c source file again (not the header!)
In the bridging header, add #import
An ordinary build will have no issues.
If you then try to do an archive build you'll get the error message.
Any ideas?
I had the same issue. I was able to get it to archive error-free once I added the path to the "Not Found" header file (in your case, PDFKitten.h) into the Header Search Paths portion of the app's Build Settings.

Creating an IPA, "contains multiple products"

I am working on an email client based on ReMail. Basically, I reused the ReMail project so that the MailCore etc dependencies would be all set up out of the box so I could build a new app on top of them. I'm trying to give the app to some beta testers via ad hoc, but when I try to create an IPA, I receive this error:
xxxx does not contain a single–bundle application or contains multiple products. Please select another archive, or adjust your scheme to create a single–bundle application.
I have set Skip Install to YES for all dependencies, and moved all files under Copy Header to the "project" section, but I am still unable to build a single APP file.
I don't know if this is significant, but when I open up the xcarchive file, within the products directory, I find a the APP file under Applications, and then a file structure mirroring the absolute path to the header files for MailCore.
Any ideas as to what might be going on? I'm very near the tearing-out-chunks-of-hair-in-frustration stage, and I don't think the unnaturally bald crazy person look would suit me.
Thanks!
Try removing the “Copy Headers” phase entirely. It's only supposed to be used for frameworks, not static libraries. The Xcode static library template that includes a “Copy Headers” phase is wrong.
Check out the “Working with Schemes and Projects in Xcode” video from WWDC 2012, starting at 45m10s.

importing private frameworks in Xcode

I am a novice iPhone programmer I want to use some of the functions in the private framework
https://github.com/kennytm/iphone-private-frameworks
The function that I want to use is in 'SpringBoard'
So I downloaded 'SpringBoard' folder in that github repo.
And created a subdirectory called "Headers" in 'SpringBoard'
and put all the header files in that folder.
And renamed 'SpringBoard' to 'SpringBoard.framework' and copied it to /Developer/Platforms/(iPhoneOS_and_iPhoneSimulator)/sdks/System/library/Frameworks folder (I can't recall full path correctly sorry)
And I got back to the xcode and right click on Frameworks -> Add existing framework -> other -> I selected 'SpringBoard.framework' folder and clicked Add.
And I built the project and got an error
'ld : framework SpringBoard not found'
My imported framework does appear on the Xcode and I can see header files in it.
but when I built it I got that error.
What am I doing wrong?
Place all of your private headers in a directory like: /User/Name/Headers/ then set USER_HEADER_SEARCH_PATHS = "/User/Name/Headers/" and make sure that ALWAYS_SEARCH_USER_PATHS = YES
Also, SpringBoard.framework is not the way to do that.Simply place the folder named SpringBoard in the above Headers folder, making sure that the headers are directly inside them. For instance: SpringBoard/SBAlert.h
/* SpringBoard is not a framework. */
Notice that you wont have to add the SpringBoard folder to your project, they should appear as you start typing, as long as you set the above headers correctly.
I'm not sure if this works, but here a suggestion:
I think the spring board framework should be in the UIKit framework you already linked anyway, so just add the header file to your project and it should work.
Otherwise this could help you:
http://www.codethecode.com/projects/class-dump/

Where are the headers for libbz2.dylib for the iPhone?

The headers for libbz2.dylib on the iPhone are missing, or contained in a less than obvious location. I've looked for bzlib.h, bz2lib.h, bz2.h, etc., grepped for patterns, and found nothing - are they included with the SDK, or do I need to just pull the header from the main libbz2 distro and use that instead?
Since the library is clearly available on the device, the header really should be in the SDK, but it appears that it isn't. I'd use the one that's packaged for the Simulator, since this is most likely to be the same as the one on the device:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/usr/include/bzlib.h
Then open a Radar case to ask that the distribution be fixed.
From the site below get the bzlib-0.5.0.0.tar.gz file and copy the files (.h and .c) inside the cbits directory to your Xcode project.
http://hackage.haskell.org/package/bzlib
So far it seems to work, I've managed to read the contents of a .bz2 file with the functions BZ2_bzReadOpen and then BZ2_bzRead.