ios - UIAlertController from Inside the AppDelegate -
i trying present uialertcontroller inside appdelegate , getting sort of errors:
i have @import uikit;
@ top.
what doing wrong?
update: here code:
switch (accountstatus) case ckaccountstatuscouldnotdetermine: case ckaccountstatusnoaccount: case ckaccountstatusrestricted: uialertcontroller *alertcontroller = [uialertcontroller alertcontrollerwithtitle:@"my alert" message:@"this alert." preferredstyle:uialertcontrollerstylealert]; break;
if remove uialertcontroller line fine! error says parse issue, expected expression. thats it
you can not create local variable in switch statement without introducing new scope. logical oring enumeration values not want - can instead have cases fall through.
switch (accountstatus) { case ckaccountstatuscouldnotdetermine: case ckaccountstatuscouldnoaccount: case ckaccountstatuscouldrestricted: { uialertcontroller *controller = [uialertcontroller alertcontrollerwithtitle:@"my alert" message:@"this alert." preferredstyle:uialertcontrollerstylealert]; } break; }
you'll need have kind of context present viewcontroller code listing not show enough provide further code
Comments
Post a Comment