Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background network session not working #389

Open
vburojevic opened this issue Dec 11, 2015 · 6 comments
Open

Background network session not working #389

vburojevic opened this issue Dec 11, 2015 · 6 comments
Labels

Comments

@vburojevic
Copy link

When favorites are syncing and app goes to background, sync is interrupted and it fails.
I saw that there is a session parameter int the SDK kAlfrescoUseBackgroundNetworkSession,but when I set it, I get an error "A background URLSession with identifier Alfresco-iOS-SDdddK already exists!", and whole app communication stops working.

NSDictionary *sessionParameters = [@{kAlfrescoMetadataExtraction : @YES, kAlfrescoThumbnailCreation : @YES, kAlfrescoUseBackgroundNetworkSession : @YES} mutableCopy];

Is background download fully supported in Alfresco iOS SDK?

@mikeh
Copy link

mikeh commented Jan 19, 2016

Hi Vedran - and apologies for the delay with my reply. I'd missed the GitHub notification for your issue.

I suspect what you're seeing is that, yes - the SDK fully supports background networking, but we haven't yet added the correct behaviour to the app to manage the time iOS gives ongoing connections after an app is backgrounded. Recently all the networking code in the SDK was migrated from NSURLConnection to NSURLSession in order to support this mode, so it should work fine for third party apps written to the most recent app specifications from Apple.

We'll likely have some app-specific behaviours that will need updating - for example the NSOperations that the file sync part of the app uses needed fixing up for iOS 9. I suspect there are a few more areas like that before we're fully compliant.

Thanks,
Mike

@vburojevic
Copy link
Author

Hi Mike,

Thanks for the response!

So if I understand correctly, background sync should work in the latest Alfresco SDK?
Can you please point me in the right direction on why the SDK keeps giving the message "A background URLSession with identifier Alfresco-iOS-SDK already exists!"?

It seems that there is a problem in the SDK code which keeps the httpRequest from initializing correctly with session params when background param is set to true.

I can't look at the implementation as it's in the static library, so not sure where is the root of the problem.

@mikeh
Copy link

mikeh commented Jan 22, 2016

Hmmm.. so that looks like the SDK isn't passing the right config down to the CMIS library. The latest version of the SDK pulls CMIS in as source code, so these things become easier to debug. I'll try to find some time over the next few working days to have a look at what's going on.

@vburojevic
Copy link
Author

Ok great, thanks! Let me know! :)

@mikeh
Copy link

mikeh commented Jan 28, 2016

An update: I've taken a walk through the SDK and CMIS code to see where the error is being thrown. It looks like the place where the CMIS code creates new NSURLSession objects isn't really correct based on the Apple documentation; a new one is created for each CMISHttpRequest rather than one being managed by the CMISBindingSession.

Currently it's the CMISHttpRequest object that's handling the NSURLSession delegate callbacks too, to be notified on each task completion, so that would also need to be updated.

I'm not sure when I'll have time to work through and re-implement how this works. For now you'll have to manage background network requests separately rather than through the SDK/CMIS stack.

@mikeh mikeh added the bug label Jan 28, 2016
@vburojevic
Copy link
Author

@mikeh Ok, thanks for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants