|
|
| Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate. |
|
|||||||
| TouchArcade.com - iPhone Game Reviews and News |
![]() |
|
|
Thread Tools | Search this Thread |
|
|
#26 |
|
macrumors 65816
Join Date: Jul 2007
Location: California
|
Remember that "release" isn't like "delete" in C++ or free in C. It merely reduces the reference count.
__________________
http://www.waffleturtle.com |
|
|
|
|
|
#27 | |
|
macrumors newbie
Join Date: Mar 2008
|
handle a call event
Quote:
Thanks |
|
|
|
|
| muscheteer |
| View Public Profile |
| Find More Posts by muscheteer |
|
|
#28 | |
|
macrumors newbie
Join Date: Mar 2008
|
get phones out of the addressbook
I've gotten this far, but when I try to use the property called kABPersonPhoneProperty in ABPerson.h I get a return value of NSCFType.
At loggerheads. Can anyone show me how to get the phone numbers, specifically the cell phone number (kABPersonPhoneMobileLabel)? (Also trying to get the phone number of the device itself) Quote:
|
|
|
|
|
| kiezarsoze |
| View Public Profile |
| Find More Posts by kiezarsoze |
|
|
#29 |
|
macrumors newbie
Join Date: Mar 2008
|
iphone sdk address book
anyone got experience with ABMultiValueRef and ABMultiValueIdentifier. How do we initialize these variables? How can we use them to access multi value strings such as phone numbers and other contact info in the iphone addressbook sdk?
|
|
|
|
| kiezarsoze |
| View Public Profile |
| Find More Posts by kiezarsoze |
|
|
#30 |
|
macrumors newbie
Join Date: Apr 2008
|
use this code get person phone number
ABAddressBookRef book = ABAddressBookCreate(); // b CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(book); NSLog(@"%@",ABMultiValueCopyValueAtIndex(ABRecordCopyValue(CFArrayGetValueAtIndex(people,indexPath.r ow),kABPersonPhoneProperty) ,0)); |
|
|
|
|
|
#31 |
|
macrumors newbie
Join Date: Apr 2008
|
Thank you for all the answers in this thread, it was very helpful !
I've tried to use the SimpleDrillDown example from the apple dev center, and replace the list of name define in the code by the name from the address book, but as you can imagine i have a probleme. This is the code i use to retrieve data from the addressBook. Code:
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFIndex nPeople = ABAddressBookGetPersonCount(addressBook);
NSMutableArray *masterList = [[NSMutableArray alloc] init];
for (int i = 0; i < nPeople; i++) {
ABRecordRef ref = CFArrayGetValueAtIndex(allPeople, i);
CFStringRef firstName = ABRecordCopyValue(ref, kABPersonFirstNameProperty);
CFStringRef lastName = ABRecordCopyValue(ref, kABPersonLastNameProperty);
NSString *contactFirstLast = [NSString stringWithFormat: @"%@", (NSString *)lastName];
CFRelease(firstName);
CFRelease(lastName);
[masterList addObject:contactFirstLast];
[contactFirstLast release];
}
self.list = masterList;
[masterList release];
Code:
NSString *contactFirstLast = (NSString *)lastName; Code:
NSString *contactFirstLast = [NSString stringWithFormat: @"%@", (NSString *)lastName]; It look likes Code:
[NSString stringWithFormat: @"LN: %@", (NSString *)lastName] Code:
(NSString *)lastName Thanks |
|
|
|
|
|
#32 |
|
macrumors newbie
Join Date: May 2008
|
i'm new in the iPhone, somebody know how add a record in the addressBook. thanks
|
|
|
|
| MediadorAv |
| View Public Profile |
| Find More Posts by MediadorAv |
|
|
#33 | |
|
macrumors 68040
Join Date: Nov 2005
|
Quote:
|
|
|
|
|
| gnasher729 |
| View Public Profile |
| Find More Posts by gnasher729 |
|
|
#34 |
|
macrumors newbie
Join Date: May 2008
|
oooh ok, no problem, I'll search other site,or anywhere, with a person like you the world don't work, so, anyway I will found it, and I'll publish all, that it is not problem for me.jajaja
secrets (like secrets expedients "X").
|
|
|
|
| MediadorAv |
| View Public Profile |
| Find More Posts by MediadorAv |
|
|
#35 |
|
macrumors newbie
Join Date: May 2008
|
this is for add record to addressBook,
-(void)editar id)sender{ABAddressBookRef libroDirec = ABAddressBookCreate(); ABRecordRef persona = ABPersonCreate(); ABRecordSetValue(persona, kABPersonFirstNameProperty, @"kate" , nil); ABRecordSetValue(persona, kABPersonLastNameProperty, @"Hutson", nil); ABAddressBookAddRecord(libroDirec, persona, nil); ABAddressBookSave(libroDirec, nil); CFRelease(persona); } this code is for remove one record in the addressbook like the record in this case with the name kate. good luck. -(void)editar id)sender{ ABAddressBookRef libroDirec = ABAddressBookCreate(); CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(libroDirec); CFIndex xPeople = ABAddressBookGetPersonCount(libroDirec); for (int i=0; i <xPeople; i++ ) { ABRecordRef ref = CFArrayGetValueAtIndex(allPeople, i); CFStringRef nombreX = ABRecordCopyValue(ref, kABPersonFirstNameProperty); CFStringRef cadena = CFSTR("kate"); if (CFStringCompare(nombreX, cadena , 0) == kCFCompareEqualTo ) { ABAddressBookRemoveRecord(libroDirec, ref, nil); ABAddressBookSave(libroDirec, nil); } } hi, hi, secrets, don't more tv, get down of the cloud programmers, we share, we aren't FBI agents, or anything else like secrets. Last edited by MediadorAv : Jun 2, 2008 at 02:44 PM. |
|
|
|
| MediadorAv |
| View Public Profile |
| Find More Posts by MediadorAv |
|
|
#36 |
|
macrumors newbie
Join Date: Jun 2008
|
Hi I'm having the same problem, and I linked the framework using Ctrl-Click Frameworks>add>existing framework and choosing "AddressBook Framework"
I add #import <AddressBook/AddressBook.h> and then if i try ABAddressBook *ab = [ABAddressBook sharedAddressBook]; I get the error: ABAddressBook undeclared but no error in the "import" line. What am I missing to link correctly the library?? Thx, Dani |
|
|
|
|
|
#37 |
|
macrumors newbie
Join Date: May 2008
|
hi, you have problem because in the iPhone is diferent like this:
addressBookRef ab=AddressBookCreate(); in the example above you see something like this |
|
|
|
| MediadorAv |
| View Public Profile |
| Find More Posts by MediadorAv |
|
|
#38 |
|
macrumors newbie
Join Date: Jun 2008
|
Multi values
hi there
has anyone ever managed to add an ABMutableMultiValue to an ABRecord? what i'm trying to do is to add a new record to the addressbook. i managed to add a record with several properties as described earlier in this thread. but when it comes to multivalues i don't have a clue... basically i want to add for example an address. i noticed that there are constants (keys) like 'kABPersonAddressZIPKey' and a 'kABPersonAddressProperty'. but how can i add the zip key to the record? thanks for any help. now i came up with this. Code:
current = ABPersonCreate(); ABRecordSetValue(current, kABPersonFirstNameProperty, @"foo", nil); ABRecordSetValue(current, kABPersonLastNameProperty, @"bar", nil); ABMutableMultiValueRef address = ABMultiValueCreateMutable(kABPersonAddressProperty); if(!ABMultiValueAddValueAndLabel(address, @"street 123", kABPersonAddressStreetKey, nil)) NSLog(@"adding value/label didn't work."); if(!ABRecordSetValue(current, kABPersonAddressProperty, address, nil)) NSLog(@"setting value didn't work."); if(!ABAddressBookAddRecord(addressBook, current, nil)) NSLog(@"adding didn't work."); ABAddressBookSave(addressBook, nil); Code:
*** -[NSCFString count]: unrecognized selector sent to instance 0x63e0 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString count]: unrecognized selector sent to instance 0x63e0' Last edited by korzieher : Jun 4, 2008 at 08:45 AM. |
|
|
|
|
|
#39 | |
|
macrumors newbie
Join Date: Nov 2008
|
contactFirstLast is autorelased object, so you should not release it.
Quote:
|
|
|
|
|
|
|
#40 |
|
macrumors newbie
Join Date: Apr 2008
|
It was a years ago (starting objective c), but thx for replying ^^
I learned a lot since that post
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|