silinman007
silinman007
  • 发布:2026-01-09 09:01
  • 更新:2026-01-09 11:52
  • 阅读:354

iOS集成uni小程序SDK,小程序中浏览图片大图崩溃

分类:uni小程序sdk

点击大图app崩溃:

uni小程序中打开浏览照片后app崩溃:

5+Runtime Crash##------

name:NSInvalidArgumentException

reason:

*** -[NSPlaceholderString initWithString:]: nil argument

callStackSymbols:

0 CoreFoundation 0x000000019cefe684 5A6C1F41-BF70-32F6-A1D6-5B894DD21362 + 968324

1 libobjc.A.dylib 0x00000001951a7c80 objc_exception_throw + 60

2 Foundation 0x000000019be4307c 5623831D-5719-33A9-9691-759F47D714D1 + 618620

3 HxflPortalIOS.debug.dylib 0x0000000109bcd434 -[DCSliderImageImageItem setContentImageStyle:index:] + 152

4 HxflPortalIOS.debug.dylib 0x0000000109cca358 -[PGNativeImageSliderView showImageView:AtIndex:] + 116

5 UIKitCore 0x000000019f071c04 2D538446-6E40-3C10-8A5F-559C938077A0 + 207876

6 QuartzCore 0x000000019e4847ec 5C3EE3D9-1AAA-3052-A6C7-B957B454AD71 + 419820

7 QuartzCore 0x000000019e484374 5C3EE3D9-1AAA-3052-A6C7-B957B454AD71 + 418676

8 QuartzCore 0x000000019e48a860 5C3EE3D9-1AAA-3052-A6C7-B957B454AD71 + 444512

9 QuartzCore 0x000000019e483b80 5C3EE3D9-1AAA-3052-A6C7-B957B454AD71 + 416640

10 QuartzCore 0x000000019e483828 5C3EE3D9-1AAA-3052-A6C7-B957B454AD71 + 415784

11 UIKitCore 0x000000019f0e9f34 2D538446-6E40-3C10-8A5F-559C938077A0 + 700212

12 UIKitCore 0x000000019f0e9a4c 2D538446-6E40-3C10-8A5F-559C938077A0 + 698956

13 UIKitCore 0x000000019f0e913c 2D538446-6E40-3C10-8A5F-559C938077A0 + 696636

14 UIKitCore 0x000000019f0e91f8 2D538446-6E40-3C10-8A5F-559C938077A0 + 696824

15 CoreFoundation 0x000000019ce490ac 5A6C1F41-BF70-32F6-A1D6-5B894DD21362 + 225452

16 CoreFoundation 0x000000019ce48328 5A6C1F41-BF70-32F6-A1D6-5B894DD21362 + 221992

17 CoreFoundation 0x000000019ce46adc 5A6C1F41-BF70-32F6-A1D6-5B894DD21362 + 215772

18 CoreFoundation 0x000000019ce45818 5A6C1F41-BF70-32F6-A1D6-5B894DD21362 + 210968

19 CoreFoundation 0x000000019ce453f8 CFRunLoopRunSpecific + 608

20 GraphicsServices 0x00000001e03fb4f8 GSEventRunModal + 164

21 UIKitCore 0x000000019f26b8a0 2D538446-6E40-3C10-8A5F-559C938077A0 + 2279584

22 UIKitCore 0x000000019f26aedc UIApplicationMain + 340

23 SwiftUI 0x00000001a1c7c898 2607F991-9547-3A50-A7E3-C0C3A09741E8 + 18245784

24 SwiftUI 0x00000001a1c7c6dc 2607F991-9547-3A50-A7E3-C0C3A09741E8 + 18245340

25 SwiftUI 0x00000001a18ed25c 2607F991-9547-3A50-A7E3-C0C3A09741E8 + 14512732

26 HxflPortalIOS.debug.dylib 0x0000000109591558 $s13HxflPortalIOS0aB6IOSAppV5$mainyyFZ + 40

27 HxflPortalIOS.debug.dylib 0x00000001095917c4 __debug_main_executable_dylib_entry_point + 12

28 dyld 0x00000001bfbaedcc 28D6D2C1-46CE-3D58-B744-B06A6C573888 + 24012

Synchronous URL loading of https://cr.dcloud.net.cn/collect/crash should not occur on this application's main thread as it may lead to UI unresponsiveness. Please switch to an asynchronous networking API such as URLSession.

Post crash result--[成功]--data--[]

libc++abi: terminating due to uncaught exception of type NSException

objc[89754]: Class _TtGC9Alamofire9ProtectedGSaFyT_T___ is implemented in both ?? (0x115b62330) and ?? (0x11709b7f8). One of the two will be used. Which one is undefined.

objc[89754]: Class _TtGC9Alamofire9ProtectedVCS7Request12MutableState is implemented in both ?? (0x115b62178) and ?? (0x11709b5b0). One of the two will be used. Which one is undefined.

objc[89754]: Class _TtGC9Alamofire9ProtectedGSaPS_12EventMonitor___ is implemented in both ?? (0x1170a6e78) and ?? (0x11709aee0). One of the two will be used. Which one is undefined.

objc[89754]: Class _TtGCs18DictionaryStorageCSo16NSURLSessionTaskC9Alamofire7Request$ is implemented in both ?? (0x115b63d00) and ?? (0x1170a4e90). One of the two will be used. Which one is undefined.

objc[89754]: Class _TtGCs18DictionaryStorageC9Alamofire7RequestCSo16NSURLSessionTask$ is implemented in both ?? (0x115b638b8) and ?? (0x1170a4cb0). One of the two will be used. Which one is undefined.

objc[89754]: Class _TtGCs11SetStorageC9Alamofire7Request$ is implemented in both ?? (0x115b62c08) and ?? (0x1170a4018). One of the two will be used. Which one is undefined.

objc[89754]: Class _TtGCs23ContiguousArrayStorageV9Alamofire10HTTPMethod$ is implemented in both ?? (0x108499400) and ?? (0x11709bcf0). One of the two will be used. Which one is undefined.

objc[89754]: Class _TtGCs23_ContiguousArrayStorageP9Alamofire12EventMonitor__$ is implemented in both ?? (0x1170a67d8) and ?? (0x117099f28). One of the two will be used. Which one is undefined.

objc[89754]: Class _TtGCs23ContiguousArrayStorageV9Alamofire10HTTPHeader$ is implemented in both ?? (0x1170a5308) and ?? (0x1170998b8). One of the two will be used. Which one is undefined.

2026-01-09 09:01 负责人:无 分享
已邀请:
Ask小助手

Ask小助手

该问题请在专业群( uni-app 官方技术交流群 1 ) 咨询,群中有相关专业的管理员和群友。

根据崩溃日志分析,问题出在-[DCSliderImageImageItem setContentImageStyle:index:]方法中尝试用nil初始化字符串(NSInvalidArgumentException - nil argument),这通常是因为图片浏览时传递了空的图片URL。

解决方案:

  1. 确保调用图片预览API时,图片URL不为空。可在js层添加校验逻辑:

    // 示例:检查图片URL有效性  
    if (currentImageUrl && currentImageUrl.trim() !== '') {  
    uni.previewImage({ urls: [currentImageUrl] });  
    }
  2. 更新到最新版HBuilderX(当前正式版4.87),新版已修复多个崩溃问题,包括"使用v-if显示组件的background样式设置为线性渐变可能引起崩溃的Bug"(参考release notes

  3. 检查是否使用了第三方图片浏览插件,若有尝试更新或替换为官方<image>组件的预览功能

  4. 若问题仍存在,建议在uni-app官方技术交流群反馈,提供具体代码片段和复现步骤

注意:iOS平台对空值处理严格,务必确保所有传递给原生模块的参数有效。

内容为 AI 生成,仅供参考
DCloud_iOS_XHY

DCloud_iOS_XHY

看起来像是依赖资源没正确添加到工程中,仔细查看一下文档

要回复问题请先登录注册