Browse Source

版本升级维护

yyqxiaoyin 5 năm trước cách đây
mục cha
commit
aaef501f45

+ 14 - 11
MKRRadioManager/Classes/MKRRadioManager/MKRWIFIDeviceManager/MKRWIFIDeviceManager.m

@@ -90,13 +90,14 @@ static inline void wd_playControl_queue(void (^block)(void)){
 
 - (void)searchDeviceWithSearchTime:(int)searchTime
                          timeBlock:(void(^)(NSInteger time))timeBlock {
-    if (_upnpErrorCode == 0) {//开始搜索设备
+    wd_playControl_queue(^{
+        if (_upnpErrorCode != 0) {
+            [self startUpnp];
+        }
         [self checkBaseURL];
         libupnp_BuildFilesList();
         libupnp_SearchDevice(20);
-    } else {
-        [self startUpnp];
-    }
+    });
     __block int count = searchTime +1;
     _searchTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(0, 0));
     dispatch_source_set_timer(_searchTimer, DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC, 0 * NSEC_PER_SEC);
@@ -196,7 +197,9 @@ static inline void wd_playControl_queue(void (^block)(void)){
 -(void)CallBackAddZoneMedia:(NSArray *)nStr Size:(NSInteger)size{
     NSLog(@"搜索到设备:%@",nStr);
     NSLog(@"%s",__func__);
-    [self addDevice:nStr];
+    wd_playControl_queue(^{
+        [self addDevice:nStr];
+    });
 }
 
 - (void)updateClockID:(NSString *)clockID clockDic:(NSDictionary *)clockDic clockTime:(NSString *)clockTime operationType:(BOOL)isOn deleteClock:(BOOL)isDelete{
@@ -284,15 +287,15 @@ static inline void wd_playControl_queue(void (^block)(void)){
         [deviceDict setObject:@"Unknown" forKey:@"devNowArtist"];
     }
     [deviceDict setObject:@"1" forKey:@"isOnLine"];
-    id<MKRWIFIDeviceManagerDelegate> obj;
-    NSEnumerator *enumerator = [self.listeners objectEnumerator];
-    while ((obj = [enumerator nextObject]) != nil) {
-        wd_main_queue(^{
+    wd_main_queue(^{
+        id<MKRWIFIDeviceManagerDelegate> obj;
+        NSEnumerator *enumerator = [self.listeners objectEnumerator];
+        while ((obj = [enumerator nextObject]) != nil) {
             if ([obj respondsToSelector:@selector(didSearchNewDevice:)]) {
                 [obj didSearchNewDevice:deviceDict];
             }
-        });
-    }
+        }
+    });
 }
 
 - (void)setM3UList:(MKRM3UListModel *)m3uListModel {