Reputation: 1645
I have an iOS application with a Today Extension. We're in testing (TestFlight) right now, and have tested on roughly ten devices. The associated Widget displays fine on all but one of these devices. On the one device the Widget displays the dreaded "Unable to Load" message. We've tried restarting the device, deleting/reinstalling the app, etc.
Looking at the device log, I saw this as the first troublesome reference:
container: WGMajorListViewController> Unable to load widget view controller with service (com.mycompany.MyApp.myApp-Today-Extension): Couldn\M-b\M^@\M^Yt communicate with a helper application.
container: WGMajorListViewController> No longer waiting on connection semaphore (<OS_dispatch_semaphore: 0x174c85410>)
container: WGMajorListViewController> Severed remote view controller connection
container: WGMajorListViewController> Widget disconnected unexpectedly
container: WGMajorListViewController> Aborting active life cycle sequence: <WGWidgetLifeCycleSequence: 0x175035460; sequenceID: com.mycompany.MyApp.myApp-Today-Extension.WGMajorListViewController.7/11/17, 3:13:00 PM; currentState: WGWidgetLifeCycleSequenceStateDidRequestRemoteView>
container: WGMajorListViewController> Remote view controller disconnected unexpectedly
container: WGMajorListViewController> Attempting to reconnect to remote view controller
The extension's code does not make any attempt to open the host application, so the error has me puzzled. Perhaps this refers to an internal (iOS) helper application?
The odd escaped characters in that first line are in the log. After these lines it tries again, maybe twice more, then fails. Eventually I see Can't request remote view controller that is blacklisted
and the device won't try again until reboot:
mediaserverd(CoreMedia)[27] <Notice>: -CMSessionMgr- cmsmHandleApplicationStateChange: CMSession: Client com.mycompany.MyApp.myApp-Today-Extension with pid '257' is now Terminated. Background entitlement: NO
mediaserverd(CoreMedia)[27] <Notice>: -CMSessionMgr- cmsmHandleApplicationStateChange: CMSession: Client com.mycompany.MyApp.myApp-Today-Extension with pid '259' is now Terminated. Background entitlement: NO
symptomsd(SymptomEvaluator)[121] <Notice>: 257 com.mycompany.MyApp.myApp-Today-Extension: Terminated (most elevated: Terminated)
symptomsd(SymptomEvaluator)[121] <Notice>: 259 com.mycompany.MyApp.myApp-Today-Extension: Terminated (most elevated: Terminated)
symptomsd(SymptomEvaluator)[121] <Notice>: Entry, display name com.mycompany.MyApp.myApp-Today-Extension uuid (null) pid 257 isFront 0
symptomsd(SymptomEvaluator)[121] <Notice>: Duplicate removal of display name com.mycompany.MyApp.myApp-Today-Extension
symptomsd(SymptomEvaluator)[121] <Notice>: Entry, display name com.mycompany.MyApp.myApp-Today-Extension uuid (null) pid 259 isFront 0
symptomsd(SymptomEvaluator)[121] <Notice>: Duplicate removal of display name com.mycompany.MyApp.myApp-Today-Extension
container: WGMajorListViewController> End sequence '(null)' with reason: disappearance transition
container: WGMajorListViewController> Can't end sequence as argument sequence ((null)) doesn't match active sequence ((null)), or there's no active sequence
container: WGMajorListViewController> Begin sequence with reason: appearance transition
container: WGMajorListViewController> Initiating new life cycle sequence: '<WGWidgetLifeCycleSequence: 0x17522b6e0; sequenceID: com.mycompany.MyApp.myApp-Today-Extension.WGMajorListViewController.7/11/17, 3:13:12 PM; currentState: WGWidgetLifeCycleSequenceStateQuiescent>'
container: WGMajorListViewController> Connection requested with reason: 'appearance transition'
container: WGMajorListViewController> Will request remote view controller
container: WGMajorListViewController> Can't request remote view controller that is blacklisted
I'm not seeing any logging from the extension code itself, nor any sign that it's actually launching.
The device in question is an iPhone 7 Plus, running the public version of iOS 10.3.2. The widget runs fine on all other devices, many of which are also 10.3.2. None of the others are the iPhone 7 Plus. The widget runs fine in the iPhone 7 Plus Simulator.
The same device runs the App Store version of the widget fine, although that version is built against iOS 9 with Xcode 7. The new version uses 10.3 as it's Base SDK, using Xcode 8.3.3.
Any thoughts?
Upvotes: 3
Views: 1964
Reputation: 5183
There's one more time when this will happen and that is if under the Run Diagnostics section of your Scheme's target, you've got the Thread Sanitizer / Undefined Behaviour Sanitizer switched ON. It seems to not like these options.
Upvotes: 4
Reputation: 1645
Wow, this was a weird one. The root of the problem was a bad image, or more specifically bad image code (exported from PaintCode). The code seems to give the Widget's Storyboard trouble on the "Plus" size devices, which are 3x. The Storyboard never initialized.
I use (and love) PaintCode, and use its image code everywhere I can. Everything is a vector, usable at any size. Good stuff. Anyway, you can use PaintCode images in Storyboards by assigning the PaintCode code to an Object dragged into the Storyboard. Then control-drag from that object to a UIImageView on the same Storyboard. At runtime, the image is drawn perfectly, no matter the device resolution or image size.
The Widget's Storyboard has three images, all from PaintCode. One of the three images was causing the problem. If I removed the image, all good. Add it back, the Widget never launches, and shows "Unable to Load". The image isn't complex, near as I can tell. Just a vector icon drawn in Sketch.
I couldn't figure out why that image was misbehaving. I played with PaintCode settings, exported a few ways, no change. So I used Sketch to create a PDF asset, and used the typical asset catalog thing for the image.
Looking through the console, I see absolutely no clues, even in retrospect. I took a guess that since the Swift code never started, and this was only "Plus" size problem, there may have been a Storyboard issue. My gut feeling once I removed all AutoLayout constraints a corrupt Storyboard file. So I recreated by Widget storyboard, and testing along the way. It broke when I added the PaintCode images back in. Once I had this, I went back to my original Storyboard, pulled out the troublesome image, and the Widget displayed fine.
I'll trim the project down and send a copy to the fine folks at PixelCut, so they're aware. If they have a workaround I'll post here.
Upvotes: 3