Explorar o código

hack-around a runtime exception caused by the OS

Felix Paul Kühne %!s(int64=10) %!d(string=hai) anos
pai
achega
263e327624
Modificáronse 1 ficheiros con 11 adicións e 0 borrados
  1. 11 0
      Sources/VLCMovieViewController.m

+ 11 - 0
Sources/VLCMovieViewController.m

@@ -26,6 +26,7 @@
 #import "VLCTrackSelectorHeaderView.h"
 #import "VLCEqualizerView.h"
 #import "VLCMultiSelectionMenuView.h"
+#import <WatchKit/WatchKit.h>
 
 #import "OBSlider.h"
 #import "VLCStatusLabel.h"
@@ -2332,12 +2333,22 @@ static inline NSArray * RemoteCommandCenterCommandsToHandle(MPRemoteCommandCente
         if (trackNumberInt > 0) {
             currentlyPlayingTrackInfo[MPMediaItemPropertyAlbumTrackNumber] = @(trackNumberInt);
         }
+
+        /* FIXME: UGLY HACK
+         * iOS 8.2 and 8.3 include an issue which will lead to a termination of the client app if we set artwork
+         * when the playback initialized through the watch extension
+         * radar://pending */
+        if ([WKInterfaceDevice class] != nil) {
+            if ([WKInterfaceDevice currentDevice] != nil)
+                goto setstuff;
+        }
         if (self.artworkImageView.image) {
             MPMediaItemArtwork *mpartwork = [[MPMediaItemArtwork alloc] initWithImage:self.artworkImageView.image];
             currentlyPlayingTrackInfo[MPMediaItemPropertyArtwork] = mpartwork;
         }
     }
 
+setstuff:
     [MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = currentlyPlayingTrackInfo;
     [[NSNotificationCenter defaultCenter] postNotificationName:kVLCNotificationNowPlayingInfoUpdate object:self];
 }