0

我无法在中声明@synthesize mCallnumberCallmethod如果我声明它正在抛出错误,并且当我尝试在标题中声明它时,它也会抛出错误并且应用程序被终止。请帮助,因为我对这个 Objective-C 非常陌生。

 -(IBAction)gotohomepage:(id)sender
{
[self dismissViewControllerAnimated:YES completion:nil];
}

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person

{
mContactNumber.text=@"";
mEmailId.text=@"";
mFirstName.text=@"";
mLastName.text=@"";

mFirstName.text=(NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
mLastName.text=(NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);




ABMultiValueRef phoneIdIndex=ABRecordCopyValue(person,kABPersonPhoneProperty);
CFIndex thePhoneIndex=ABMultiValueGetCount(phoneIdIndex);
if (thePhoneIndex!=0) {
    mPhoneNumber=(NSString *)ABMultiValueCopyValueAtIndex(phoneIdIndex, 0);
    mContactNumber.text=mPhoneNumber;
}


ABMultiValueRef emailIdIndex=ABRecordCopyValue(person, kABPersonEmailProperty);
CFIndex theEmailIndex=ABMultiValueGetCount(emailIdIndex);
if (theEmailIndex!=0) {
    mEmailIdIndex=(NSString *)ABMultiValueCopyValueAtIndex(emailIdIndex, 0);
    mEmailId.text=mEmailIdIndex;
}    
[self dismissModalViewControllerAnimated:YES];
mCall.hidden=NO;
mEmail.hidden=NO;
mSMS.hidden=NO;
return NO;
}

 - (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker
{
[self dismissModalViewControllerAnimated:YES];
}

  - (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController   *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
 {
 return YES;
 }


-(IBAction)callmethod
 {

contactsViewController *actionHandleView=[[contactsViewController alloc]initWithNibName:@"contactsViewController" bundle:nil];
actionHandleView.mCallNumber=mPhoneNumber;
[self.navigationController pushViewController:actionHandleView animated:YES];
[actionHandleView release];
 }
4

2 回答 2

0

试试这个,看看它是否有效。

@property(nonatomic,retain) NSString *mCallNumber;
于 2013-02-07T11:30:49.900 回答
0

您很可能只需要添加一行内容:

@property (retain) NSString * mCallNumber;

到您的“ contactsViewController”.h 文件。

顺便说一句,Objective C 的最佳实践是将类名的第一个字符大写,并将所有变量的第一个字符保持小写。所以不用“ contactsViewController”,叫它“ ContactsViewController”。

于 2013-02-07T10:48:44.990 回答