OneDrive / onedrive-sdk-ios

OneDrive SDK for iOS
https://dev.onedrive.com
Other
100 stars 87 forks source link

clients=0 in app extension #155

Open mobilekosmos opened 7 years ago

mobilekosmos commented 7 years ago

OneDrive works great in my app but trying to make it work in our app extension is not working. When calling NSArray *clients = [ODClient loadClients]; in the extension this is an empty array. Keysharing is set in the app target and in the extension target, podfile is configured right and all code is actually compiling without errors. While debugging the app extension following function from the sdk, appconfig is populated as much as it is while debugging the app itself, but the result clients is then empty:

+ (NSArray *)clientsFromAppConfig:(ODAppConfiguration *)appConfig
{
    // There must be at least one App Id
    NSParameterAssert(appConfig.microsoftAccountAppId || appConfig.activeDirectoryAppId);

    NSArray *clients = nil;
    if (appConfig.accountStore && appConfig.authProvider){
        clients = [ODClient clientsFromAccountStore:appConfig.accountStore withAuthProvider:appConfig.authProvider httpProvider:appConfig.httpProvider logger:appConfig.logger];
    }
    else if (appConfig.accountStore){
        clients = [ODClient clientsFromAccountStore:appConfig.accountStore httpProvider:appConfig.httpProvider logger:appConfig.logger];
    }
    return clients;
}

I already read all the documentation and don't know what else I could do, do you have any examples for app extensions? Any ideas what could the problem be?

While debugging I could see that the parameter sharedGroup in following function in ADKeychainTokenKeystore is always nil, not matter if debugging in the app itself or in the extension:

-(id) initWithGroup: (NSString *)sharedGroup

Shouldn't this be actually "com.microsoft.adalcache"?