2016-09-23 1 views
1

xcode에서 던진 경고를 초기화하는 객체를 초기화 중입니다. 다음 구문xcode에서 Appdelegate 객체 초기화하기 8

AppDelegate *del=[[UIApplication sharedApplication]delegate]; 
+7

던지는 경고는 무엇입니까? 'AppDelegate'는 당신 자신의'UIAppDelegate' 서브 클래스입니까? 그런 다음'AppDelegate * del = (AppDelegate *) [[UIApplication sharedApplication] delegate];'이 문제를 해결할 수 있지만, AppDelegate 객체가 아닌 경우에는 문제가 발생할 수 있습니다. – Larme

답변

0

내가 당신에게 AppDelegate에 객체를 사용하고이

#define theAppDelegate \ 
((AppDelegate *)[UIApplication sharedApplication].delegate) 

희망처럼 appdelegate.h에 파일을 decalre 또 다른 옵션을 제공에서 아무 잘못인가이 잘 작동