objective c - ABMultiValueCopyArrayOfAllValues Potential leak of an object -


I am trying to fix "possible leakage of the object". I have a warning on

  NSArray * phone = (__bridge_transfer NSArray *) ABMultiValueCopyArrayOfAllValues ​​(ABRecordCopyValue (person, kabPersonPhoneProperty)); The same 
  NSArray * phone = (__bridge_transfer NSArray *) ABMultiValueCopyArrayOfAllValues ​​(ABRecordCopyValue (person, kABPersonPhoneProperty)) on   

and ; Xcode is saying: 'Abrcordcopy value' returns a core foundation object with a +1 call to work, which is leaked to a +1 catalog object: object object is not referenced later in this execution path I have been + 1

I understand how it is not right

  - (bool) peoplePickerNavigationController:. (ABPeoplePickerNavigationController *) peoplePicker shouldContinueAfterSelectingPerson: (ABRecordRef) person {NSString * firstName = (__bridge NSString *) ABRecordCopyValue (person, kABPersonFirstNameProperty); NSString * Last name = (__breeze NSString *) ABRecordCopyValue (person, kABPersonLastNameProperty); NSString * Fullname = @ ""; If (firstName! = Zero) {full name = [fullname stringBeffing string: first name]; } If (last name! = Zero) {fullname = [NSString string withString: [fullName stringByAppendingString: @ ""]] ;;;; Full name = [NSString stringWithString: [Full name stringBeffing string: last name]]; } NSMutableArray * tempArray = [[NSMutableArray alloc] init]; [TempArray addObject: fullName]; [Contact add object: temperedare]; _userNameTextField.text = [tempArray object atxxx0]; CFRYEliz ((__ Bridge CFTepreph) (first name)); CFRYEliz ((__ Bridge CFTepreph) (last name)); NSArray * Phone = (__bridge_transfer NSArray *) ABMultiValueCopyArrayOfAllValues ​​(ABRecordCopyValue (person, KABPersonPhoneProperty)); NSArray * Email = (__Bridge_transfer NSArray *) ABMultiValueCopyArrayOfAllValues ​​(ABRecordCopyValue (person, kABPersonEmailProperty)); If (Phone) {[tempArray addObject: [Phone ObjectAdWords: 0]]; } And {{tempArray addObject: @ "No phone number was set."]; } If (email) {[tempArray addObject: [Email object at index: 0]]; } And {{tempArray addObject: @ "No email was set."]; } // Now add the tempArray to the contactsOre. _mobPhoneTextField.text = [tempArray object import indicator: 1]; _emailTextField.text = [tempArray object atxaxx] 2:; Delete [[Visual Controller Displays Contacts] ViewControllerAnimated: Yes Complete: Zero]; no return; }    

you have to divide

  NSArray * Phone = (__Bridge_transfer NSArray *) ABMultiValueCopyArrayOfAllValues ​​(ABRecordCopyValue (person, KABPersonPhoneProperty));   

In separate orders so that you can issue the returned item by ABRecordCopyValue () :

  Ctvpfpp = value by ABRecordCopyValue (person) Are there. , Cablesphonephoneproperty); NSArray * Phone = (__bridge_transfer NSArray *) ABMultiValueCopyArrayOfAllValues ​​(value); CFRelease (value);    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -