DevMate / DevMateKit

Development and Distribution Assistance Platform for Mac Developers
https://devmate.com
21 stars 3 forks source link

activateWithInfo, completionHandler never called #34

Closed codebar33 closed 6 years ago

codebar33 commented 6 years ago

Hi,

I reopen this one. I thought it was working last week but it's not.. So activation now works fine when using [ NSApplication sharedApplication ] instead of NSApp in an Objective-C console app. But the completionHandler is never called so it makes the integration difficult to achieve, even if I put a sleep of 20 seconds instead of the while loop, before calling DMKIsApplicationActivated, DMKIsApplicationActivated return false with DMKevlarError DMKevlarActivationInProcess. But then after when I relaunch the app, the app is activated so activation worked fine.

Here is the code:

activationDone = NO;
[
    [ NSApplication sharedApplication ]
    activateWithInfo: activationInfo
    completionHandler:
    ^( BOOL success, NSError * error )
    {
        ( void )success;
        ( void )error;

        activationDone = YES;
    }
];

while( !activationDone )
{
    sleep( 1 );
}

DMKevlarError error;

if( DMKIsApplicationActivated( &error ) )
{
    return true;
}

return false;
codebar33 commented 6 years ago

I also tried to call activateWithInfo from a dispatch_async, it didn't work either.

dimaty commented 6 years ago

We're preparing an update of Kevlar lib this week that should fix your problem. It would be great if you could give us a bundle id of your CLI app, and we send you a new copy of lib to test this issue. Can you do this as a new comment here or via support message?

codebar33 commented 6 years ago

Hi Dimaty, thanks a lot, our CLI bundle ID is: com.DigiDNA.iMazingMac.CLI

codebar33 commented 6 years ago

Hi Dimaty, many thanks for the fix, I just tested wot the new Kevlar build and it works!