iOS Plugin : disable Plot

35 views
Skip to first unread message

Alexandre LocowL

unread,
Oct 16, 2015, 5:00:38 AM10/16/15
to plot-users
Hi,
I would like not to enable Plot at the launch of my app, because the user isn't yet logged in.

So I do this :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

    [Plot initializeWithLaunchOptions:launchOptions delegate:self];

    if ([[Divers getAccount] token] != nil)

    {

        NSLog(@"enable");

        [Plot enable];

    }

    else

    {

        NSLog(@"disable");

        [Plot disable];

    }


[....]

}



Here's what happens :

2015-10-16 10:54:23.796 BonsPlans[23953:1864909] disable

2015-10-16 10:54:23.797 BonsPlans[23953:1864909] Plot| Plot disabled

2015-10-16 10:54:23.823 BonsPlans[23953:1864990] Plot| Plot enabled



Is it normal ?



Thanks,



Alexandre


Jan-Pieter van den Heuvel

unread,
Oct 16, 2015, 7:42:46 AM10/16/15
to plot-...@googlegroups.com
Hi Alexandre,

Our plugin will be enabled by default and is initialized in a separate thread, so it is possible that you see this race condition. Have you seen the "enableOnFirstRun" parameter in the configuration file (documentation)? If you set it to false you will get the expected behaviour. Furthermore I think it would be a good idea to not call [Plot disable] during the start of your app (since it is disabled by default when you set "enableOnFirstRun" to false) and call it when you want Plot to stop working (e.g. when your user logs out).

Does this answer your question?

Kind regards,
Jan-Pieter

--
You received this message because you are subscribed to the Google Groups "plot-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plot-users+...@googlegroups.com.
Visit this group at http://groups.google.com/group/plot-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/plot-users/8e012263-20f8-4cd8-a076-77625798374b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jan-Pieter van den Heuvel
Plot Projects I Development



Follow us on Twitter
Find and connect with us on Facebook
Keep up with us on our blog

Alexandre LocowL

unread,
Oct 19, 2015, 10:10:12 AM10/19/15
to plot-users
Hi Jan-Pieter,
I had already tried to set enableOnFirstRun parameter to false.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{    

    [Plot initializeWithLaunchOptions:launchOptions delegate:self];


[...]

}


Here is the plogconfig.json :

{

"publicToken""XXXXXXXX",

"enableOnFirstRun"false

}


Here is the logs : 

2015-10-19 15:43:40.559 BonsPlans[14511:4396727] Plot| Plot enabled



Regards,


Alex

Mark van der Tol

unread,
Oct 21, 2015, 3:49:20 AM10/21/15
to plot-users
Hi Alexandre,

After calling Enable or Disable Plot will remember the setting, even when the app is restarted. After a restart Plot will remain enabled or disabled. EnableOnFirstRun only affects the first time after the app has been installed.

Because Plot has to run in the background we recommend just enabling Plot after the first login and then keep Plot enabled. When doing this in didFinishLaunching race conditions could be created, thus we recommend to move this to the view where the user logs in or out.

Will this work for you?

Kind regards,
Mark van der Tol
Plot Projects

Alexandre LocowL

unread,
Oct 22, 2015, 5:17:49 AM10/22/15
to plot-users
Hi Mark,
Thanks for your answer.
It seems to work.


Regards,

Alex
Reply all
Reply to author
Forward
0 new messages