-
tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...IOS 2017. 2. 6. 18:53반응형
tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...
스레드 안에서 > 스레드 또 호출하거나 , 웹의 자바스크립트를 사용할려고 하니까 나왔다...
스레드에서 메소드를 콜 할땐,
[self performSelectorOnMainThread:@selector(CardUpdate) withObject:NULL waitUntilDone:YES];
-(
void
)CardUpdate{
if
(cardnum ==@
""
|| cardexpmon ==@
""
|| cardexpyear ==@
""
){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@
"UnKown Card"
delegate:nil cancelButtonTitle:@
"확인"
otherButtonTitles: nil];
[alert show];
NSString* script = [NSString stringWithFormat:@
"cardupdate('%@', '%@','%@');"
, @
""
, @
""
,@
""
];
[_MainWebView stringByEvaluatingJavaScriptFromString:script];
}
else
{
NSString* script = [NSString stringWithFormat:@
"cardupdate('%@', '%@','%@');"
, cardnum, cardexpmon,cardexpyear];
[_MainWebView stringByEvaluatingJavaScriptFromString:script];
}
}
이런식으로 써워야 한다.
반응형'IOS' 카테고리의 다른 글
Missing Info.plist key (5) 2017.02.10 앱 스토어(APP STORE) 배포하기 (6) 2017.02.10 하단 탭바 아이콘 , 어플 아이콘 만들기 및 주의사항 (0) 2016.12.23 xcode 하단 탭바 이미지, 아이콘이미지 만들기 (0) 2016.12.23 XCODE 에서 Frameworks 추가하기 (0) 2016.12.23