이번 에러의 경우에는 CoreData를 사용하면서 나왔던 오류이다.
사건의 발단
imageUrl의 타입을 URL타입으로 변경하였던 부분이다 차라리 String타입으로 설정하는게 더 쉽게 접근할 수 있다.
하지만 이대로 진행하 보았다.
그러다 마주친 에러
"nw_connection_copy_connected_local_endpoint_block_invoke [C3] Client called nw_connection_copy_connected_local_endpoint on unconnected nw_connection nw_connection_copy_connected_remote_endpoint_block_invoke [C3] Client called nw_connection_copy_connected_remote_endpoint on unconnected nw_connection nw_connection_copy_protocol_metadata_internal_block_invoke [C3] Client called nw_connection_copy_protocol_metadata_internal on unconnected nw_connection nw_connection_copy_connected_local_endpoint_block_invoke [C1] Connection has no local endpoint nw_connection_copy_connected_local_endpoint_block_invoke [C1] Connection has no local endpoint https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/600.png *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unacceptable type of value for attribute: property = "imageUrl"; desired type = NSURL; given type = Swift.__StringStorage; value = https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/600.png.' *** First throw call stack: ( 0 CoreFoundation 0x00000001804ae0f8 __exceptionPreprocess + 172 1 libobjc.A.dylib 0x0000000180087db4 objc_exception_throw + 56 2 CoreData 0x000000018645a854 _PFManagedObject_coerceValueForKeyWithDescription + 1552 3 CoreData 0x0000000186460a48 _sharedIMPL_setvfk_core + 176 4 phoneBook 0x0000000102591cf4 $s9phoneBook05PhoneB14ViewControllerC10createDatayyF + 1584 5 phoneBook 0x0000000102591618 $s9phoneBook05PhoneB14ViewControllerC9buttonTapyyF + 252 6 phoneBook 0x00000001025916ac $s9phoneBook05PhoneB14ViewControllerC9buttonTapyyFTo + 36 7 UIKitCore 0x00000001853d58ec -[UIApplication sendAction:to:from:forEvent:] + 96 8 UIKitCore 0x000000018498d4ec -[UIBarButtonItem _triggerActionForEvent:fallbackSender:] + 204 9 UIKitCore 0x0000000184968394 __45-[_UIButtonBarTargetAction _invoke:forEvent:]_block_invoke + 28 10 UIKitCore 0x0000000184968298 -[_UIButtonBarTargetAction _invoke:forEvent:] + 160 11 UIKitCore 0x00000001853d58ec -[UIApplication sendAction:to:from:forEvent:] + 96 12 UIKitCore 0x0000000184ce23d0 -[UIControl sendAction:to:forEvent:] + 108 13 UIKitCore 0x0000000184ce2714 -[UIControl _sendActionsForEvents:withEvent:] + 268 14 UIKitCore 0x0000000184ce2750 -[UIControl _sendActionsForEvents:withEvent:] + 328 15 UIKitCore 0x0000000184ce13ac -[UIControl touchesEnded:withEvent:] + 392 16 UIKitCore 0x0000000185409354 -[UIWindow _sendTouchesForEvent:] + 900 17 UIKitCore 0x000000018540a878 -[UIWindow sendEvent:] + 3104 18 UIKitCore 0x00000001853ea238 -[UIApplication sendEvent:] + 580 19 UIKitCore 0x000000018546dff4 __dispatchPreprocessedEventFromEventQueue + 1684 20 UIKitCore 0x0000000185470e90 __processEventQueue + 5604 21 UIKitCore 0x00000001854697f0 __eventFetcherSourceCallback + 160 22 CoreFoundation 0x000000018040ee48 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 23 CoreFoundation 0x000000018040ed90 __CFRunLoopDoSource0 + 172 24 CoreFoundation 0x000000018040e500 __CFRunLoopDoSources0 + 232 25 CoreFoundation 0x0000000180408be8 __CFRunLoopRun + 768 26 CoreFoundation 0x00000001804084d4 CFRunLoopRunSpecific + 572 27 GraphicsServices 0x000000018ef2aae4 GSEventRunModal + 160 28 UIKitCore 0x00000001853d0a28 -[UIApplication _run] + 868 29 UIKitCore 0x00000001853d46b0 UIApplicationMain + 124 30 UIKitCore 0x00000001848736a8 __swift_destroy_boxed_opaque_existential_1Tm + 10048 31 phoneBook 0x000000010259fe34 $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 120 32 phoneBook 0x000000010259fdac $s9phoneBook11AppDelegateC5$mainyyFZ + 44 33 phoneBook 0x000000010259fee0 main + 28 34 dyld 0x0000000103069544 start_sim + 20 35 ??? 0x0000000102b7e0e0 0x0 + 4340572384 36 ??? 0x6173800000000000 0x0 + 7022096981489090560 ) libc++abi: terminating due to uncaught exception of type NSException"
이런 에러였다.
검색을 해보니 결국은 타입의 문제 일단 URL타입으로 변경 후 저장까지는 성공을하였다.
그리고 print문으로 호출해보니 name과 number는 정상적으로 나오는데 url이 그냥 "imageUrl"로 표기가 되었다.
알고보니 URL타입의 경우에 NSURL타입으로 변경하여 저장을해야 URL을 온전히 저장할 수있다고 한다.
그렇기 때문에
소스를 변경하였더니
정상적으로 url을 조회할 수 있었다.
'Ios > Error노트' 카테고리의 다른 글
[Error] UISearchBar 네 이놈... (0) | 2024.08.02 |
---|---|
[Error] Alert이후 처리 (0) | 2024.07.16 |
[Error] cornerRadius가 먹히지 않았던 오류 (0) | 2024.07.12 |
[Error] SnapKit/ConstraintMakerRelatable.swift:85: Fatal error: Expected superview but found nil when attempting make constraint `equalToSuperview`. (0) | 2024.06.21 |
[Error]No such file or directory (0) | 2024.06.20 |