I use a UIViewRepresentable for the UIPageControl in SwiftUI, but there is a crash that feedback by customer.
Need help.
Date/Time: 2021-11-16 16:30:58.4009 +0800
Launch Time: 2021-11-16 15:30:03.3930 +0800
OS Version: iPhone OS 14.7.1 (18G82)
Release Type: User
Baseband Version: 3.04.01
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000010
VM Region Info: 0x10 is not in any region. Bytes before following region: 4334485488
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 1025b0000-102ab0000 [ 5120K] r-x/r-x SM=COW ...hispers Stage
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [445]
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 CoreSVG 0x00000001c362c168 CGSVGDocumentGetCanvasSize + 12
1 CoreUI 0x0000000194b26098 -[_CUIThemeSVGRendition canvasSize] + 68
2 CoreUI 0x0000000194ae21e0 __36-[CUINamedVectorGlyph alignmentRect]_block_invoke + 80
3 CoreUI 0x0000000194ae0d04 -[CUINamedVectorGlyph _performWithLockedRendition:] + 76
4 CoreUI 0x0000000194ae2134 -[CUINamedVectorGlyph alignmentRect] + 148
5 UIKitCore 0x000000018abf0ef4 -[_UIImageCUIVectorGlyphContent initWithCGImage:CUIVectorGlyph:scale:] + 220
6 UIKitCore 0x000000018adb67d8 -[CUINamedVectorGlyph+ 7903192 (UIKitAdditions) UIImageWithAsset:configuration:flippedHorizontally:] + 140
7 UIKitCore 0x000000018b5c95d8 __78-[_UIAssetManager imageNamed:configuration:cachingOptions:attachCatalogImage:]_block_invoke_2 + 316
8 UIKitCore 0x000000018b5cbf14 __82-[_UIAssetManager _lookUpObjectForTraitCollection:withAccessorWithAppearanceName:]_block_invoke + 96
9 UIKitCore 0x000000018adf01a0 -[UITraitCollection _enumerateThemeAppearanceNamesForLookup:] + 264
10 UIKitCore 0x000000018b5cbe38 -[_UIAssetManager _lookUpObjectForTraitCollection:withAccessorWithAppearanceName:] + 200
11 UIKitCore 0x000000018b5c9478 __78-[_UIAssetManager imageNamed:configuration:cachingOptions:attachCatalogImage:]_block_invoke + 740
12 UIKitCore 0x000000018b5c8f58 -[_UIAssetManager imageNamed:configuration:cachingOptions:attachCatalogImage:] + 316
13 UIKitCore 0x000000018adb9bf8 -[UIImageAsset imageWithConfiguration:] + 444
14 UIKitCore 0x000000018b5c9b14 -[_UIAssetManager imageNamed:configuration:] + 96
15 UIKitCore 0x000000018ada5348 +[UIImage _systemImageNamed:withConfiguration:allowPrivate:] + 316
16 UIKitCore 0x000000018b0511b8 -[_UIPageIndicatorStore indicatorImage] + 84
17 UIKitCore 0x000000018b05184c -[_UIPageIndicatorStore sizeForMaximumContentSizeFittingWidth:] + 152
18 UIKitCore 0x000000018b4bad70 -[_UIInteractivePageControlVisualProvider _intrinsicContentSizeWithPageControlSize:] + 652
19 UIKitCore 0x000000018b4bc114 -[_UIInteractivePageControlVisualProvider layoutSubviews] + 168
20 UIKitCore 0x000000018ab3c678 -[UIPageControl layoutSubviews] + 76
21 UIKitCore 0x000000018b738be4 -[UIView+ 17873892 (CALayerDelegate) layoutSublayersOfLayer:] + 2576
22 QuartzCore 0x000000018bbbf670 -[CALayer layoutSublayers] + 308
23 QuartzCore 0x000000018bbbfb54 CA::Layer::layout_if_needed+ 1473364 (CA::Transaction*) + 548
24 UIKitCore 0x000000018b724c38 -[UIView+ 17792056 (Hierarchy) layoutBelowIfNeeded] + 552
25 UIKitCore 0x000000018b4bb5a0 -[_UIInteractivePageControlVisualProvider didUpdateNumberOfPages] + 348
26 UIKitCore 0x000000018ab3bdbc -[UIPageControl setNumberOfPages:] + 92
27 ------------------------------
28 SwiftUI 0x000000018f7d063c PlatformViewRepresentableAdaptor.makeViewProvider+ 11372092 (context:) + 472
29 SwiftUI 0x000000018f7d09b0 protocol witness for PlatformViewRepresentable.makeViewProvider+ 11372976 (context:) in conformance PlatformViewRepresentableAdaptor<A> + 24
30 SwiftUI 0x000000018f415bcc closure #1 in closure #2 in closure #1 in PlatformViewChild.updateValue+ 7461836 () + 348
31 SwiftUI 0x000000018f41a6d4 partial apply for closure #1 in closure #2 in closure #1 in PlatformViewChild.updateValue+ 7481044 () + 80
32 SwiftUI 0x000000018f41a700 partial apply for thunk for @callee_guaranteed () -> + 7481088 (@owned PlatformViewHost<A>) + 32
33 SwiftUI 0x000000018f413a60 PlatformViewRepresentableValues.asCurrent<A>+ 7453280 (do:) + 152
34 SwiftUI 0x000000018f415a44 closure #2 in closure #1 in PlatformViewChild.updateValue+ 7461444 () + 200
35 SwiftUI 0x000000018f414e3c closure #1 in PlatformViewChild.updateValue+ 7458364 () + 2732
36 SwiftUI 0x000000018f414028 PlatformViewChild.updateValue+ 7454760 () + 644
37 SwiftUI 0x000000018f0a7b00 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 3865344 (_:) + 32
Post
Replies
Boosts
Views
Activity
Xcode Version 15.0.1 (15A507)
Crash log
Hardware Model: iPhone14,7
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
OS Version: iPhone OS 16.6 (20G75)
Release Type: User
Baseband Version: 1.80.02
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Triggered by Thread: 26
Application Specific Information: abort() called
Last Exception Backtrace:
0 CoreFoundation 0x1b3c54cb4 __exceptionPreprocess + 164
1 libobjc.A.dylib 0x1accf03d0 objc_exception_throw + 60
2 Foundation 0x1adf6950c -[NSData(NSData) _base64EncodingAsString:withOptions:] + 1072
3 Foundation 0x1ae2cf8bc Data.base64EncodedString(options:) + 640
...
6 libdispatch.dylib 0x1bb11a320 _dispatch_call_block_and_release + 32
7 libdispatch.dylib 0x1bb11beac _dispatch_client_callout + 20
8 libdispatch.dylib 0x1bb11ef8c _dispatch_queue_override_invoke + 788
9 libdispatch.dylib 0x1bb12d944 _dispatch_root_queue_drain + 396
10 libdispatch.dylib 0x1bb12e158 _dispatch_worker_thread2 + 164
11 libsystem_pthread.dylib 0x213a85da0 _pthread_wqthread + 228
Thread 26 name: Dispatch queue: com.apple.root.default-qos
Thread 26 Crashed:
0 libsystem_kernel.dylib 0x1f2c11578 __pthread_kill + 8
1 libsystem_pthread.dylib 0x213a8c118 pthread_kill + 268
2 libsystem_c.dylib 0x1bb17c178 abort + 180
3 libc++abi.dylib 0x2139cabf8 abort_message + 132
4 libc++abi.dylib 0x2139ba444 demangling_terminate_handler() + 348
5 libobjc.A.dylib 0x1accf5ea4 _objc_terminate() + 144
6 libc++abi.dylib 0x2139c9fbc std::__terminate(void (*)()) + 16
7 libc++abi.dylib 0x2139c9f60 std::terminate() + 56
8 libdispatch.dylib 0x1bb11bec0 _dispatch_client_callout + 40
9 libdispatch.dylib 0x1bb11ef8c _dispatch_queue_override_invoke + 788
10 libdispatch.dylib 0x1bb12d944 _dispatch_root_queue_drain + 396
11 libdispatch.dylib 0x1bb12e158 _dispatch_worker_thread2 + 164
12 libsystem_pthread.dylib 0x213a85da0 _pthread_wqthread + 228
13 libsystem_pthread.dylib 0x213a85b7c start_wqthread + 8
12 libsystem_pthread.dylib 0x213a85b7c start_wqthread + 8
My code
private func encodeStringTo64(fromString: String) -> String? {
let plainData = fromString.data(using: .utf8)
return plainData?.base64EncodedString(options: [])
}
Call foundation method
extension Data {
...
/// Returns a Base-64 encoded string.
///
/// - parameter options: The options to use for the encoding. Default value is `[]`.
/// - returns: The Base-64 encoded string.
@inlinable public func base64EncodedString(options: Data.Base64EncodingOptions = []) -> String
}
Description
This foundation method don't have throws, but it throw an exception. It will cause a crash.