3

Sometimes, apparently randomly, when using MSStickerView in my IMessageExtension, the following error is raised :

Fatal Exception: NSInvalidArgumentException
*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]

It seems to be a bug in MSStickerView, but I don't succeed to identify what's causing it and/or to catch it and rescue (since it seems to be about private method performing asynchronously)

Does anybody know what could be going on ?

This is the stack trace :

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x19387d1b8 __exceptionPreprocess
1  libobjc.A.dylib                0x1922b455c objc_exception_throw
2  CoreFoundation                 0x19375b870 -[__NSPlaceholderArray initWithObjects:count:]
3  CoreFoundation                 0x1937675fc +[NSArray arrayWithObjects:count:]
4  Messages                       0x1af2bf688 -[MSStickerView _loadSticker]
5  Messages                       0x1af2becc8 -[MSStickerView layoutSubviews]
6  UIKit                          0x19972fa80 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
7  QuartzCore                     0x196bdd9d8 -[CALayer layoutSublayers]
8  QuartzCore                     0x196bd24cc CA::Layer::layout_if_needed(CA::Transaction*)
9  QuartzCore                     0x196bd238c CA::Layer::layout_and_display_if_needed(CA::Transaction*)
10 QuartzCore                     0x196b4f3e0 CA::Context::commit_transaction(CA::Transaction*)
11 QuartzCore                     0x196b76a68 CA::Transaction::commit()
12 QuartzCore                     0x196b77488 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
13 CoreFoundation                 0x19382a0c0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
14 CoreFoundation                 0x193827cf0 __CFRunLoopDoObservers
15 CoreFoundation                 0x193828180 __CFRunLoopRun
16 CoreFoundation                 0x1937562b8 CFRunLoopRunSpecific
17 GraphicsServices               0x19520a198 GSEventRunModal
18 UIKit                          0x19979d7fc -[UIApplication _run]
19 UIKit                          0x199798534 UIApplicationMain
20 libxpc.dylib                   0x19295bcc8 _xpc_objc_main
21 libxpc.dylib                   0x19295d944 xpc_main
22 Foundation                     0x1944a23c4 service_connection_handler
23 PlugInKit                      0x19bf4e128 -[PKService run]
24 PlugInKit                      0x19bf4dc90 +[PKService main]
25 PlugInKit                      0x19bf4e14c +[PKService _defaultRun:arguments:]
26 Foundation                     0x1944880d4 NSExtensionMain
27 libdispatch.dylib              0x1927395b8 (Missing)
Drico
  • 1,284
  • 15
  • 33
  • I would guess you are returning nil from `- (MSSticker *)stickerBrowserView:(MSStickerBrowserView *)stickerBrowserView stickerAtIndex:(NSInteger)index` in some circumstance. – combinatorial Feb 18 '17 at 05:40
  • 1
    @combinatorial in fact, I'm using a custom view to display stickers, I'm not using MSStickerBrowserView. – Drico Feb 20 '17 at 10:49
  • Try setting a breakpoint on `MSStickerView _loadSticker` it looks like the call to `arrayWithObjects` happens after rendering the thumbnail. So perhaps there are cases where the MSSticker imageURL does not exist, or points to a image file that can't be loaded. – combinatorial Feb 20 '17 at 16:20
  • I am facing the same issue, were you able to find any solution? – Nikhil Manapure Oct 03 '17 at 11:36
  • I found [this](https://forums.developer.apple.com/thread/52525), but not helpful. :( – Nikhil Manapure Oct 03 '17 at 11:39

0 Answers0