위해 나는 다음과 같이 수행합니다 SEGUE 있습니다. 내가하는 일은 서버에 대한 원격 호출을하는 것이고, 서버 응답이 올바르게 돌아 오면, 나는 그 segue를 가진 새로운 페이지로 사용자를 데려다려고한다.iPad 용 시뮬레이터 오류하지만하지 아이폰
그것은 아이폰 시뮬레이터에서 작동하지만 아이 패드가 (식별 문자열이 모두 동일) 및 아이 패드에이 오류와 충돌 :
bool _WebTryThreadLock(bool), 0x68f9cb0: 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...
1 WebThreadLock
2 -[UITextRangeImpl isEmpty]
3 -[UITextRange(UITextSelectionAdditions) _isCaret]
4 -[UITextSelectionView setCaretBlinks:]
5 -[UIKeyboardImpl setCaretBlinks:]
6 -[UIKeyboardImpl setDelegate:force:]
7 -[UIKeyboardImpl setDelegate:]
8 -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:]
9 -[UINavigationController navigationTransitionView:didStartTransition:]
10 -[UINavigationTransitionView transition:fromView:toView:]
11 -[UINavigationTransitionView transition:toView:]
12 -[UINavigationController _startTransition:fromViewController:toViewController:]
13 -[UINavigationController _startDeferredTransitionIfNeeded]
14 -[UINavigationController pushViewController:transition:forceImmediate:]
15 -[UINavigationController pushViewController:animated:]
16 -[UIStoryboardPushSegue perform]
17 -[UIStoryboardSegueTemplate perform:]
18 -[UIViewController performSegueWithIdentifier:sender:]
19 __41-[PlanBusinessController submitBusiness:]_block_invoke_0
20 __block_global_0
21 -[NSBlockOperation main]
22 -[__NSOperationInternal start]
23 -[NSOperation start]
24 __block_global_6
25 _dispatch_call_block_and_release
26 _dispatch_worker_thread2
27 _pthread_wqthread
28 start_wqthread
나 또한 너무 독서에 사용하고 있지 않다 Obective-C 스택 트레이스 때문에 문제가 무엇인지 찾아내는 데 어려움을 겪고 있습니다. 여기
내가이 작업을 수행하는 방법입니다
- (IBAction)submitBusiness:(id)sender
{
// Make a url to send
NSURL *url = [NSURL URLWithString:full_encoded_url_string];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
// ***************
// TODO: ok I dont really understand what this is
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
// **************
[NSURLConnection sendAsynchronousRequest:urlRequest queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
{
// I took out a lot of the logic code that is not needed
[self performSegueWithIdentifier:@"PlanToBusiness" sender:self];
}];
}
}
서버에 대한 원격 호출을 어떻게 처리합니까? 비동기 호출이고 주 스레드가 아닌 웹 서비스를 호출하는 스레드에서 segue하려고하면이 문제가 발생할 수 있습니다. 아마도 좀 더 많은 코드를 게시 할 수 있습니까? 요청이 중단되고 segue가 수행되는 전체 기능이 있습니까? –
@Paul 예, 비동기 호출을 수행하고 리턴 코드에서 segue를 시도합니다. 이 오류가 발생하지 않도록이 작업을 수행하는 올바른 방법은 무엇입니까? ... 지금 코드 게시 중 ... – GeekedOut
@Paul 방금 사용한 코드 중 일부를 추가했습니다 ... 많은 오류 검사 및 기타 논리를 수행했지만, 내가하는 일은 요주의입니다. – GeekedOut