3

The newsstand framework will only handle downloads for you when you are on wifi, but it's not very clear what happens over a 3G cellular network. Here is the scenario:

My app is running in the background when it receives a remote notification telling it that new content is available and is not connected to wifi at the time.

I create a new NKIssue and a NKAssetDownload for that issue (a zip file containing all I need for that issue).

I call [asset downloadWithDelegate:self];

From what I can tell, the asset does not get downloaded - even when I connect to wifi later on, the asset never gets downloaded and if I query the downloadingAssets of NKIssue, it is an empty array.

So it appears there is no way to get back my asset object to start the download again (assuming now on wifi).

I could keep a separate reference to the asset object around to restart its download, or could create a new NKAssetDownload object (where did the existing one go?) or could check whether I'm on 3G/wifi when the remote notification comes in and branch in my code accordingly or something else(?), but I feel like I'm missing something. The documentation seems incomplete here too.

Has anyone found a good way of dealing with this?

Brynjar
  • 1,252
  • 1
  • 11
  • 24
  • now realise there is also a `downloadingAssets` property on NKLibrary as well as NKIssue, but I'm finding this an empty array too. – Brynjar Mar 21 '12 at 16:16
  • Are you resuming your downloads in applicationDidFinishLauncingWithoptions? Your download should start if app launches when connected in wifi – msk Mar 22 '12 at 04:32
  • @MSK Well that's the problem, to restart my downloads, I need a reference to them, but the `downloadingAssets` array is empty.. – Brynjar Mar 22 '12 at 11:31
  • I think iOS should hold the "content-available" notification until iPad is not connect to wifi. That means your call to [asset downloadWithDelegate:self]; should happen when in wifi only. If it is not the case then [NKLibrary downloadingAssets].count should be > 0 in didFinishLaunchingWithOptions method if NOT then it could be a bug in the way NS is implemented. – msk Mar 22 '12 at 11:47

0 Answers0