SocketMobile / cocoapods-capturesdk

CaptureSDK for iOS
Other
6 stars 0 forks source link

SDK version(1.6) does not work for new iOS devices #4

Closed tvision251 closed 1 year ago

tvision251 commented 1 year ago

Hello, I upgraded the old SDK (1.3) to the latest one(1.6). But there is a problem with Softcam(iPhone Camera). The current version works fine for old iPhone devices, but it does not work for the newest devices(iPhone 12, iPhone 13, iPad retina 8th).

When I try to debug in the newest devices, the didNotifyArrivalForDevice was not called and the friendlyName is BLE Device. In some old devices, the friendlyName is SocketCam C820 and the didNotifyArrivalForDevice method was called. Here is the code.

-(void)didNotifyRemovalForDeviceManager:(SKTCaptureHelperDeviceManager *)deviceManager withResult:(SKTResult)result {
    NSLog(@"didNotifyRemovalForDeviceManager: %ld", result);
}

-(void)didNotifyArrivalForDeviceManager:(SKTCaptureHelperDeviceManager*) deviceManager withResult:(SKTResult) result {
    NSLog(@"didNotifyArrivalForDeviceManager: %@", deviceManager.friendlyName);
    [deviceManager setDispatchQueue:dispatch_get_main_queue()];
    [deviceManager getFavoriteDevicesWithCompletionHandler:^(SKTResult result, NSString *favorites) {
        if (SKTSUCCESS(result)) {
            if([favorites isEqualToString:@""]) {
                [deviceManager setFavoriteDevices:@"*" completionHandler:^(SKTResult result) {
                    NSLog(@"setting new favorites returned: %ld", result);
                }];
            }
        }
    }];
}

-(void)didNotifyArrivalForDevice:(SKTCaptureHelperDevice*) device withResult:(SKTResult) result {

    if (SKTSUCCESS(result)) {
        if([device.friendlyName containsString:@"SocketCam"]) {
//        if(device.deviceType == SKTCaptureDeviceTypeSocketCamC820 || device.deviceType == SKTCaptureDeviceTypeSocketCamC860) {
            socketCam = device;

            NSMutableDictionary* overlayParameter = [[NSMutableDictionary alloc]init];
            [overlayParameter setValue:self forKey:SKTCaptureSocketCamContext];
            [socketCam setOverlayView:overlayParameter completionHandler:^(SKTResult result) {
                NSLog(@"didNotifyArrivalForDevice: SetOverlayView : %ld", result);
            }];
        } else {
            lastDeviceConnected = device;
        }
    }
}

-(void)didNotifyRemovalForDevice:(SKTCaptureHelperDevice*) device withResult:(SKTResult) result {
    NSLog(@"didNotifyArrivalForDevice");

    if (socketCam != nil && socketCam == device ) {
        socketCam = nil;
    } else {
       ...
    }
}
cyrille-socket commented 1 year ago

Hi @tvision251,

can you check the value of result when didNotifyArrivalForDevice is supposed to be called please?

The other thing is we don't have in the code, a placeholder device name like BLE device that you mention. The closest thing is the friendly name of the BLE Device manager which friendly name is BLE Device Manager.

If you have more details on the issue I could try to understand a little bit better what is going on.

Thank you. Cyrille

tvision251 commented 1 year ago

Hello, @cyrille-socket Thank you for your reply. It's really a good question. Right now, didNotifyArrivalForDevice is not called for the newest devices. didNotifyRemovalForDeviceManager is called for all devices, but didNotifyArrivalForDevice is not called for those newest devices.

cyrille-socket commented 1 year ago

@tvision251 those "newest" devices, can you tell me more about their iOS versions please?

Do you use CaptureHelper? Objective-C? Swift?

tvision251 commented 1 year ago

From iPhone X Pro, it seems the didNotifyArrivalForDevice method is not called. "newest" mean iPhone X Pro, iPhone 12, 13, 14 and iPad Retina(8th). I use the CaptureHelper and we built the project in Objective-C.

cyrille-socket commented 1 year ago

@tvision251 What is the iOS version of those new devices please?

And is SocketCam enabled on those new devices? FYI, it is not enabled by default.

tvision251 commented 1 year ago

OS version is 15 and 16

cyrille-socket commented 1 year ago

@tvision251 And is SocketCam enabled on those new devices? FYI, it is not enabled by default.

You can find a sample to enable it here: https://github.com/SocketMobile/capturesingleentryswift-ios/blob/f8593958436023f3469857f05e6d73ba564a4c44/SingleEntrySwift/SettingsViewController.swift#L141

tvision251 commented 1 year ago

Great! It works now. Thanks.

cyrille-socket commented 1 year ago

Great! Thank you for your feedback.