CookieSyncManager::createInstance() needs to be called before CookieSyncManager::getInstance()

前端 未结 1 689
南方客
南方客 2020-12-29 13:10

This error message is pretty clear:

CookieSyncManager::createInstance() needs to be called before CookieSyncManager::getInstance()

1条回答
  •  礼貌的吻别
    2020-12-29 13:38

    I followed the official documentation in one of recent apps and CookieSyncMasnager is working just fine...

    I have the following:

    onCreate()
        CookieSyncManager.createInstance(this);
    
    onResume()
        CookieSyncManager.getInstance().startSync();
    
    onPause()
        CookieSyncManager.getInstance().stopSync();
    

    I am using the activity context in the createInstance(). You don't mention which context you're using?

    You also don't mention doing a CookieSyncManager.getInstance().stopSync() in onPause() (or similar). So perhaps for a resume you are calling CookieSyncManager.getInstance().startSync() twice without an intervening stop?

    0 讨论(0)
提交回复
热议问题