citrix / citrix-mam-sdks

The MAM SDK instrument your apps to enable enforcing policies and controls that are configured in Citrix Endpoint Management.
https://developer.cloud.com/citrixworkspace/mobile-application-integration
11 stars 4 forks source link

iOS Cordova - initializeSDKs callbacks not executed #128

Open ninaDeimos opened 1 month ago

ninaDeimos commented 1 month ago

I am using the Cordova Plugins for iOS and followed the integration guide. I am trying to initialize the SDKs like this

core.initializeSDKs(
    () => console.log('SDKs initialized'),
    () => console.log('SDKs failed to initialize'),
    localauth,
    containment,
    compliance,
    network
);

But neither the success callback nor the failure callback are ever executed. I checked the Device Logs but I would like to help to interpret it. devicelog.log

E.g. do logs like CTXMAMCoreFramework, 10, 2, /Users/jenkins/jenkins/workspace/iossdk_ctxmamcore_Release_24.5.0/CTXMAMCore/DataStorage/CTXMAMKeychainInterface.m, -[CTXMAMKeychainInterface deleteData:accessGroup:serviceName:accessibleAttribute:error:], 1012, Status: -25300, error: The item cannot be found.. or CTXMAMCoreFramework, 3, 1, /Users/jenkins/jenkins/workspace/iossdk_ctxmamcore_Release_24.5.0/CTXMAMCore/DataStorage/CTXMAMDataStorage.m, -[CTXMAMDataStorage p_deleteKeychainDataForHashedName:], 914, ConfigManagerAuthVault: Unable to delete data. BackgroundAccessError = Error Domain=Citrix Code=-25300 "The item cannot be found." UserInfo={NSLocalizedDescription=The item cannot be found.}; NoBackgroundAccessError = Error Domain=Citrix Code=-25300 "The item cannot be found." UserInfo={NSLocalizedDescription=The item cannot be found.} or [WSSLv0.5.0][V]: [DSv0.2.7] Vault: SZ3M2Z456W.com.citrix.mdx/MAMSDKSharedDataOUMDqbtNfhrjKfCGQ3MxahpyXiIlyZrwaN7UGGFJ0MI-yeKData, exists?1, accessible?1, data-loaded?1 (load-result:1), error:(null) or [WSSLv0.5.0][V]: [DSv0.2.7] Vault: SZ3M2Z456W.com.citrix.mdx/MAMSDKSharedData, exists?0, accessible?1, data-loaded?0 (load-result:1), error:Error Domain=Citrix Code=-25300 "The item cannot be found." UserInfo={NSLocalizedDescription=The item cannot be found.}

mean, there is a problem with my keychain access configuration?

But after these logs I still see

CTXMAMCore - Now initializing CTXMAMCore SDK
CTXMAMCore - Now initializing CTXMAMAnalytics SDK
CTXMAMCore - Now initializing CTXMAMCompliance SDK
CTXMAMCore - Now initializing CTXMAMContainment SDK
CTXMAMCore - Now initializing CTXMAMLocalAuth SDK
CTXMAMCore - Now initializing SmartNetwork SDK

so it looks like the initialization is triggered, but never finishes?

And after that I don't see any logs for Citrix anymore at all. Can someone help my find the issue?

ShawnInTibco commented 1 month ago

Hi @ninaDeimos , codes seem fine. and serials "initializing" logs means that every sdk is initialized successfully. log"CTXMAMCoreFramework, 3, 1, /Users/jenkins/jenkins/workspace/iossdk_ctxmamcore_Release_24.5.0/CTXMAMCore/DataStorage/CTXMAMDataStorage.m, -[CTXMAMDataStorage p_deleteKeychainDataForHashedName:], 914, ConfigManagerAuthVault: Unable to delete data. BackgroundAccessError = Error Domain=Citrix Code=-25300 "The item cannot be found." UserInfo={NSLocalizedDescription=The item cannot be found.}; NoBackgroundAccessError = Error Domain=Citrix Code=-25300 "The item cannot be found." UserInfo={NSLocalizedDescription=The item cannot be found.} means nothing. just init logs. and for success and fail callback function, it's deprecated for now, function won't be called anymore.

To check if mamsdk works fine, just configure some policy and check if it works as expected.

Such as "block camera", and if you try to open Camera when you configure it with "true", app will show a alert message

ninaDeimos commented 1 month ago

Hi @ShawnInTibco , thank you for the answer. I actually made the callbacks work with this solution from another ticket But is the deprecation documented somewhere? Because in the guide that is packaged together with the Cordova iOS Plugins, it is not mentioned.

ShawnInTibco commented 1 month ago

happy to know you have find a way to make it work. And at the same time you can see the way to call init is different. try registerSdksInitializedAndReady

`core.registerSdksInitializedAndReady(()=>console.log('SDKs initialized'));`
ninaDeimos commented 1 month ago

Actually I tried that (as I commented in the other ticket), but that didn't work. That callback was never called either.