iPhone : uialertview는 시뮬레이터에서 작동하지만 iPhone에서 앱이 동결됩니다.

StackOverflow https://stackoverflow.com/questions/1917513

  •  20-09-2019
  •  | 
  •  

문제

빈 값이있는 컨트롤러에서 돌아온 후 경고가 나타나야하는 프로젝트에서 작업하고 있습니다. 시뮬레이터에서 팝업되지만 iPhone에서는 컨트롤러에서 돌아올 때 앱이 얼어 붙어 종료됩니다. 어떤 아이디어?

내 코드는 다음과 같습니다.

  - (void)manualBarcodeViewControllerDidFinish:(ManualBarcodeViewController *)controller
    {

        ......
        ......

        else if([barcode isEqualToString:@""])
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"error" message:@"message" delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:@"otherbutton"];
            [alert show];
        [alert release];
         }
     }
도움이 되었습니까?

해결책

당신의 otherButtonTitles 인수는 말만 해져야합니다.

일반적으로, 가변적인 수의 인수를 취하는 방법은 끝에 없어야합니다. 예를 들어:

[NSArray arrayWithObjects:objA, objB, nil];

그리고 당신의 경우 :

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"error" message:@"message" delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:@"otherbutton", nil];

다른 팁

이 질문을 살펴보아야 할 수도 있습니다.

uialertview는 릴리스 모드에서 충돌을 일으 킵니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top