App crashes playing video in background on iOS

Fuse version 0.23.0 (build 7041) OS X El Capitan Version 10.11.6

Running the “Video Login Screen Fuse Example” in Background audio mode causes App to crash.

Steps

  1. Download example project - Download and extract Zip from: https://github.com/yupferris/fuse-example-video-login-screen/tree/master
  2. Download video with sound - Download and extract Zip of Graham Uhelski’s “The Valley” (you need a video with audio - the original video appears to be silent) from: http://mazwai.com/#/videos/220 2a. Copy the video (thevalleygrahamuheslkimp4.mp4) into the assets folder
  3. Edit MainView.ux 3a. On Line 31 - Change “nature.mp4” to “thevalleygrahamuheslkimp4.mp4” 3b. Save
    1. Preview on iOS - (I’m using Atom, so I right-click on the code and choose: “Fuse preview - iOS”)
    2. Turn on Background Audio - In Xcode (using 7.3.1), go to the “Capabilities” tab, turn on “Background Modes” and check: “Audio, Airplay and Picture in Picture” (next to “Modes:”)
    3. Run on iPhone - In Xcode, ensure your iPhone is plugged in and the active scheme is set to run on your iPhone and click the run button.
    4. Wait for sound - once the app is running, wait until you can hear sound from your iPhone.
    5. Press the iPhone’s On/Off button. 8a. You should continue to hear the videos music coming from your iPhone. If not, go back to step 5.
    6. Count to 3
    7. Press the iPhone’s Home Button
    8. Crashes - the app crashes with “Thread 1: EXC_BAD_ACCESS (code=1, address=0x1)” in Fuse.Controls.Native.iOS.GraphicsView.mm
void GraphicsView::EndDraw(uObject* handle)
{
    uStackFrame __("Fuse.Controls.Native.iOS.GraphicsView", "EndDraw(ObjC.Object)");
    @autoreleasepool
    {
        [] (::id handle) -> void
        {
            ::GLKView* glkView = (::GLKView*)handle;
            [glkView display];                       // <-- Thread 1: EXC_BAD_ACCESS (code=1, address=0x1)
        } (::g::ObjC::Helpers::GetHandle(handle));

    }

}

Don’t know how display is declared, but possibly it needs to be (strong, nonatomic)?

Hi!

Thanks for your report. I have filed an internal ticket for this issue. display is a method on GLKView, if this happens while the app is in the background I have an inkling that GLKView is touching resources it shouldnt when display is called. Kinda makes sense since the app is in the background

Is it possible to get an approximate date when this should be resolved?

Hi!

The fix is included in the upcoming release. Also, it is live now in the pre-release at https://www.fusetools.com/downloads/channel/qa.

Thanks Vegard - that seems to have done it!

From time-to-time I’m getting a libsystem_kernel.dylib`mach_msg_trap when returning form background mode after the app has been interrupted while in background by another audio stream - like Siri. But when I build for release, it doesn’t seem to happen so the issue might be with live-reload.

Thanks Vegard, the last pre-release solve a really nasty bug which was crashing my app, related to display and GLKView. It seems to work perfect now, thanks!