2013-02-07 34 views
0

我無法在Callmethod中聲明@synthesize mCallnumber。如果我聲明它是拋出錯誤,並且當我嘗試在頭中聲明它時,它也會拋出錯誤,並且應用程序會終止。請大家幫忙,因爲我對這個目標非常陌生-C。地址簿peoplePickerNavigationController

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

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

{ 
[email protected]""; 
[email protected]""; 
[email protected]""; 
[email protected]""; 

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]; 
} 

回答

0

更可能你只需要簡單地以這樣一行添加:

@property (retain) NSString * mCallNumber; 

你的 「contactsViewController」 .h文件中。

B.T.W.,Objective C的最佳做法是大寫一個Class名的第一個字符並保留所有變量的第一個字符小寫。因此,而不是「contactsViewController」,稱之爲「ContactsViewController」。

+0

在Callmethod中我調用CallViewController.m,如下所示 – reddy

0

試試看看它是否有效。

@property(nonatomic,retain) NSString *mCallNumber;