0
싱글 톤이 있고 여러 뷰 컨트롤러에서 사용할 사용자 지정 메서드를 만듭니다. 이 방법은 이메일 작성자를 표시하는 것입니다. 경고 메시지는 강력한 호환되지 않는 형의 UIViewController * __글로벌 메서드에서 대리자를 할당 할 수 없습니다.
어떤에서
ID __Nullable에 할당됩니다
[[MySingle singleton] emailSend:@"Testing" inVc:self];
: 나는하여이 전화를 다른 viewcontrollers에
-(void)emailSend:(NSString*)bodyStr inVC:(UIViewController*)vc { if ([MFMailComposeViewController canSendMail]) { NSString *messageBody = bodyStr; MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init]; mc.mailComposeDelegate = vc; // <-- warning [mc setSubject:@"Say Hello"]; [vc presentViewController:mc animated:YES completion:NULL]; }else{ // Not setup } }
어떻게 작동 시키는가?
안녕 님, Y 수 이런 시도 : __weak typeof (self) weakSelf = self; [[MySingle singleton] emailSend : @ "테스트"inVc : weakSelf]; ** 또는 ** 자신을 클래스 이름으로 바꾸기 (강점 및 약점 시도) – ajjjjjjjj
VC에 델리게이트를 추가해야합니다. 클래스 MyVC : –
SeanLintern88
변경 : ** nVC : (id) vc **. – KKRocks