0
をクリックしてエラーの取得:私はスウィフト4.0は、コードをコンパイルするとき、私は、この行にエラーを取得しています、オブジェクト
} as! MKDirectionsHandler)
エラーを使用していますことは言う:Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
は、誰かが助けてください。コードは以下の通りである:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
* frame #0: 0x00000001039d5c74 Map`ViewController.getDirections(sender=0x00007fff5c22e610, self=0x00007ff278553bc0) at ViewController.swift:117
frame #1: 0x00000001039d6828 Map`@objc ViewController.getDirections(sender:) at ViewController.swift:0
frame #2: 0x00000001050d1275 UIKit`-[UIApplication sendAction:to:from:forEvent:] + 83
frame #3: 0x000000010524e4a2 UIKit`-[UIControl sendAction:to:forEvent:] + 67
frame #4: 0x000000010524e7bf UIKit`-[UIControl _sendActionsForEvents:withEvent:] + 450
frame #5: 0x000000010524d6ec UIKit`-[UIControl touchesEnded:withEvent:] + 618
frame #6: 0x00000001056ba1a5 UIKit`_UIGestureEnvironmentSortAndSendDelayedTouches + 5560
frame #7: 0x00000001056b4045 UIKit`_UIGestureEnvironmentUpdate + 1506
frame #8: 0x000000010a912d37 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
frame #9: 0x000000010a912c8e CoreFoundation`__CFRunLoopDoObservers + 430
frame #10: 0x000000010a8f7254 CoreFoundation`__CFRunLoopRun + 1572
frame #11: 0x000000010a8f69b9 CoreFoundation`CFRunLoopRunSpecific + 409
frame #12: 0x0000000107e309c6 GraphicsServices`GSEventRunModal + 62
frame #13: 0x00000001050cf5e8 UIKit`UIApplicationMain + 159
frame #14: 0x00000001039dac77 Map`main at AppDelegate.swift:12
frame #15: 0x000000010d79cd81 libdyld.dylib`start + 1
frame #16: 0x000000010d79cd81 libdyld.dylib`start + 1
calculateメソッドにはオプションの 'MKDirectionsResponse'と' Error'があります。 https://developer.apple.com/documentation/mapkit/mkdirectionshandlerと 'as! '行を削除してください。 MKDirectionsHandler' – Lamar
@Lamarだから私は削除しました! MKDirectionsHandlerと私にエラーが表示されます。 – Ram
エラーは何ですか? – Lamar