I am currently creating an iOS Newsstand app. I have issues added and working the way I want. However, when I try to go and download their remote file, it doesn't seem to be working. None of the delegate methods are getting called and no file is being written.
This is what I have for certain:
- A UITableViewController that is a NSURLConnectionDownloadDelegate.
- UIBackgroundModes (in the info.plist file) has 'newsstand-content' added
- #import is in the header of my UITableViewController
- NSURLConnectionDownloadDelegate's methods are implemented
The Following code happens when the user agrees to download the issue (Note: Issue is not nil):
// Download the Issue!
NSLog(@"Starting Download of issue %@",issue.name);
// Generate the url of the issue
NSURL * downloadURL = [dataManager pdfURLForIssue:issue];
// Create the request
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:downloadURL
cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
timeoutInterval:30.0];
// Create the NKAssetDownload object
NKAssetDownload *assetDownload = [issue addAssetWithRequest:request];
// Set user info so I know which issue's UIProgressView to update
[assetDownload setUserInfo:[NSDictionary dictionaryWithObjectsAndKeys:issue.name,@"Name",
nil]];
// start download
[assetDownload downloadWithDelegate:self];
I have no idea what is going on. From all I have read, I seem to have implemented everything properly; however, nothing is happening. I set breakpoints, NSLogs and such; but nothing. I even let it run for a while then checked the director the [issue contentURL] said the file would be moved too (in my connectionDidFinishDownloading:destinationURL: method).
Can anybody help? Or maybe some ideas for me? I have been stuck for days. If you need to see more code, just let me know. Thank you!