Sorting the Address Book database problem

Joined
Mar 9, 2012
Messages
3
Reaction score
0
Points
1
Hi I just started xcoding 2 weeks time ago and recently I had try to write a simple app which to sorting the entire Address Book database from iPhone.

I facing a little problem where Xcode show as i colour in silver - method in protocol not implement.

that is no error is this problem i just couldn't found where is my error. hope any expert can assist me.


#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}

- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

- (IBAction)adbook:(id)sender
{
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFMutableArrayRef peopleMutable = CFArrayCreateMutableCopy(kCFAllocatorDefault, CFArrayGetCount(people), people);

CFArraySortValues(peopleMutable,
CFRangeMake(0, CFArrayGetCount(peopleMutable)),
(CFComparatorFunction)ABPersonComparePeopleByName,
(void*)ABPersonGetSortOrdering());

CFRelease(addressBook);
CFRelease(people);
CFRelease(peopleMutable);


}
@end
 
Joined
Aug 13, 2011
Messages
200
Reaction score
7
Points
18
Location
West Sussex
Your method declarations should be like this.

Code:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Your code here
}

And this one should be.

Code:
- (IBAction)adbook:(id)sender
{
    // Your code here
}

In the code you posted the colons and first brace is missing.

Also when using protocols, make sure you implement all of the required methods, as
stated in the protocols documentation, and double check your spellings of any methods.

Regards Mark
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top