Creating an ABPerson object - xcode

This problem is almost certainly gonna have a really simple answer, but I just can't see it. I'm programming an app for the iPhone in Xcode and I'm trying to create an instance of an ABPerson object, but can't. In my .h file, I am importing as follows:
#import <AddressBook/AddressBook.h>
#import <AddressBook/ABPerson.h>
Then when I try to create it using "ABPerson *person;", it gives the error, "Unknown type name 'ABPerson'".
I have searched the internet and there doesn't seem to be much on the use of ABPerson and where I have seen it used, they have done it like this and its worked fine.
Ultimately, I want to create a VCard containing the details of somebody which the user can then save to their phone so if you know of another way of doing this which would eliminate this problem, that would also be great.
Thanks,
Matthew

Have you added the AddressBook framework to your app? Look in XCode4, look at your project file -> Build Phases -> Link Binary with Libraries.

Try this.
#import <AddressBook/AddressBook.h>
#import <AddressBook/ABAddressBook.h>

Related

Adding Parse to iOS App Errors

I'm trying to incorporate Parse into my iOS app. After adding all the Frameworks and building the app I get several error messages none being related to the code itself.
I read somewhere that you need to add the Facebook SDK to your project and I did that but it only took away 3 of the errors. Does anybody know the proper instructions on installing the Facebook SDK to your project? Perhaps I didn't add it correctly?
Thanks.
Are you using Swift?
I had the same problem and it was because the frameworks are in Obj-C.
If that's the case, you need to add a bridge header file - here's a quick overview of how to do so: http://blog.parse.com/announcements/building-apps-with-parse-and-swift/
Here's the content of my bridge header file:
#import <Parse/Parse.h>
#import <Bolts/Bolts.h>
#import <ParseUI/ParseUI.h>
#import <ParseFacebookUtilsV4/PFFacebookUtils.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>

Xcode - Parse & facebook header file(SDK) error

I want to use both Parse & facebook SDK's with my app, I did everything and added every library from both Parse & facebook and edited my App Delegate file according to the docs, but I keep getting errors in my bridging-header file:
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <ParseFacebookUtilsV4/PFFacebookUtils.h>
#import <FacebookSDK/FacebookSDK.h>
#import <Parse/Parse.h>
Error:
'FBSDKCoreKit/FBSDKCoreKit.h' file not found
The errors are not specific to any statement, I delete one and the next gets an error. This file is called "MyApp-Bridging-Header.h"
The first thing I would try is to add the AVFoundation and CoreLocation frameworks to your target. Then delete the derived data from your project by going to window-->projects. Do this then clean and build your project.
Sidenote: Make sure when you type in "#import " the FBSDKCoreKit is autofilled in after you have typed a few letters. If the framework has been added already, it should give you the option to autofill the import. If it is not added this may not show up, and if this is the case, make sure your framework is added to your project in finder.
Hope this helps!

Adding multiple Cib / Xib files in Cappuccino

Currently I'm working on a product that uses the Cappuccino Framework and the Objective-J language.
I created my project using this command after installing Cappuccino: capp gen -t NibApplication Myapp
The Problem I'm facing is that I want to keep my code and GUI clean.
By doing so I wanted to split the GUI up in separate Xib / Cib (compiled version Cappuccino can read) and separate controllers, like I do with iOS and Mac apps.
I couldn't find on the internet or on the docs how to do so.
Also, all the examples (including the NibApplication template) contains only 1 xib file.
In short what I'm after is to load a controller, based on a XIB file which holds the window. All the outlets are connected to the controller I loaded.
Is there anyone who knows how to do it?
Thanks in advance and have a nice day!
The typical way to do this is to use a CPWindowController or a CPViewController for each xib you want to load. Here's what it might look like:
var myViewController = [[CPViewController alloc] initWithCibName:"mynib" bundle:[CPBundle mainBundle]];
This would load Resources/mynib.cib from your main bundle. Normally you'd also subclass CPViewController so as to give yourself a convenient spot for your control code.
Fixed it myself! I used this tutorial: http://vimeo.com/8948460
But instead of using atlas I used XCode. Just follow the steps but with XCode and you'll be fine if you want the above to happen.

A page-turning interface for iOS apps in Leaves Github Project xCode

I'm trying to implement leaves project link is below:
https://github.com/brow/leaves
but there are serverl errors I couldn't find out the issues that why there are so many errors
So would anyone please help me how can i solve this problem
I don't know where I'm doing mistake, I download the zip file and then extract it and run the project that's it.
I'm attaching the screenshot of the errors as well.
You can see the errors in the screenshot.
Import QuarzCore and CoreGraphics frameworks to your project.
Add this your .h file of the class that causes the errors:
#import <QuartzCore/QuartzCore.h>

Need help understanding Xcode *.pch files

I'm working on a 3rd party UIKit replacement for iOS. I have it building as a framework using a seriously helpful project from GitHub. (Not mine, but if you have interest, it's here.
I'm trying to use my library in other projects I'm writing. Like I said, it's basically a drop-in replacement for much of UIKit, so I decided to import the framework in my project's *.pch file instead of everywhere I might wish to use a button, action sheet, alert view, etc...
When I DON'T have an #import directive in a header file and declare a property of type MBMButton, the compiler gives me an error of "Unknown type name 'MBMButton'; did you mean 'UIButton'?" Oddly enough, the code will still run (even though this is an error, not a warning). Adding #class MBMButton or #import <MBMUIKit/MBMUIKit.h> resolves this compiler complaint.
When I DON'T have an #import directive in an implementation file (or its header) and call a method that exists in MBMUIButton but NOT in UIButton, I get a compiler error of "No visible #interface for 'UIButton' declares the selector...". As before, the code will actually run, since it's a valid call.
Now, I've done some digging, and I've changed my project's settings. Where I didn't have any value in the GCC_PREFIX_HEADER, I added the file name. Noting the Quick Help description by Apple, I tried both "ProjectName-Prefix.pch" and "./ProjectName-Prefix.pch". Neither seemed to resolve the problem. I eventually figured out that the Target-level settings override the Project-level settings, and that the Target-level settings already specified "ProjectName/ProjectName-Prefix.pch". So that was a dead end. (Nice to learn exactly what the relative path settings are, though!)
I'm OK with not using the *.pch file. It's only a convenience, and I can definitely use appropriate #class and #import directives. What's bugging me is not understanding the issue. How should one use the *.pch file?
The prefix header file is automatically included in every .m file in your project but not in any .h files.
Therefore, any references to classes will require the header to be included or a forward declaration:
#class MyClass;
However for #protocols you'll need the full header, a forward declaration won't work:
#protocol MyProtocol; //this won't work
#interface MyController : UIViewController <MyProtocol>
…
#end

Resources