Giter Site home page Giter Site logo

hwifiledownload's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hwifiledownload's Issues

grab the downloaded file from other source

hello
im working with audio library,
when it playing the song,
it download the played song in the background ,
my question is that when i press in download button using your library, can the library take or resume the same already download file of the player and continue for what it pause or done

Can HWIFileDownloader Init Fail?

Hey,

Great work on this. I wanted to find out if HWIFileDownloader Init can fail? If not I will submit a PR to fix that for swift. I checked the code and it didn't seem like it could.

Cheers

remaining time

geat work
but could you plz add the ability to see the remaining time for each downloaded item

Ability to set NSURLSession delegateQueue to other than main?

Hi,

HWIFileDownload is awesome, thanks for making it available!

Is there any, besides a patch, to specify the NSURLSession.delegateQueue? I notice that you set it to [NSOperationQueue mainQueue] in the HWIDownloader initializers. However, we are using HWI from Unity and want to avoid interrupting the main queue when possible. Could we add an option to specify the queue or at least specify that it should create a new serial/concurrent queue other than the main queue?

I could receive HWIDownloadDelegate calls on the main thread and then immediately dispatch them to another thread, but that would mean that all of HWIDownloader's non network work would still be done on the main thread since its callbacks from NSURLSession happen on the main thread (by virtue of the delegate queue).

Any ideas?

Thanks!

NSURLErrorResourceUnavailable

Hi,

I am using HWIFileDownload and it is great, thanks for making it!

Though i have a one small problem. I get this error from costumers and i only have logs. Sadly i can't reproduce this issue, so i have no clue why it is happening.

ERR: Download with error -1008 (http status: 200)

It happens in didCompleteWithError NSURLSessionTaskDelegate and its because finalLocalFileURL is nil. I have no idea why it becomes nil in any situation.

Did anybody experience this? I would love to get more information about this error. Thanks in advance!

I wanna know that how to store the filePath for every DemoDownloadItem

Thx for the Demo,I add a property for the DemoDownloadItem interface, after I download the file ,I wanna store the filePath for every DemoDownloadItem. Could u pls tell me how to implement it? And I wanna initialize the downloadItemsArray from the internet ,maybe not 11 pieces of datas , I wanna know how to apply the downloadIdentifier for every item?

file name generated

@Heikowi
i always put a identifer as number
but the downloaded filename is like this
063BF1C1-EFF9-4E66-8EB1-20FF24368A55.mp3
how its generated, and how i can changed ?
thank you

Thread race on HWIFileDownloader.activeDownloadsDictionary

I'm getting thread race warnings for HWIFileDownloader.activeDownloadsDictionary (of type NSMutableDictionary<NSNumber *, HWIFileDownloadItem *>).

When I open my application, I verify if a certain number of files are downloaded on the device storage (±80 files). For the ones that are missing, I'm starting the download process (in parallel).

The race condition that I get is related to

- (void)startDownloadWithDownloadToken:(nonnull NSString *)aDownloadToken
                         fromRemoteURL:(nullable NSURL *)aRemoteURL
                       usingResumeData:(nullable NSData *)aResumeData

At line 313, we add the aDownloadItem in the activeDownloadsDictionary ([self.activeDownloadsDictionary setObject:aDownloadItem forKey:@(aDownloadID)];)

At the same time, on another thread, a download has finished and

- (void)handleSuccessfulDownloadToLocalFileURL:(nonnull NSURL *)aLocalFileURL
                                  downloadItem:(nonnull HWIFileDownloadItem *)aDownloadItem
                                    downloadID:(NSUInteger)aDownloadID

is called. Inside this method, we remove the download item from the activeDownloadsDictionary ([self.activeDownloadsDictionary removeObjectForKey:@(aDownloadID)];).

Here's the full Thread Sanitizer output

==================
WARNING: ThreadSanitizer: race on NSMutableDictionary (pid=18849)
  Modifying access of NSMutableDictionary at 0x7b08002e6180 by thread T10:
    #0 -[__NSDictionaryM setObject:forKey:] <null> (CoreFoundation:x86_64+0x19160b)
    #1 -[HWIFileDownloader startDownloadWithDownloadToken:fromRemoteURL:usingResumeData:] <null> (HWIFileDownload:x86_64+0x63ba)
    #2 -[HWIFileDownloader startDownloadWithIdentifier:fromRemoteURL:] <null> (HWIFileDownload:x86_64+0x4848)
    #3 -[DVTemplateDownloadStore startDownloadForTemplateFileModel:] <null>
    #4 -[DVTemplateDownloadStore startDownloadingIncompleteFilesInTemplateArray:] <null>
    #5 __52-[DVMainViewController verifyUserTemplatesIntegrity]_block_invoke <null>
    #6 __tsan::invoke_and_release_block(void*) <null> (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x676ab)
    #7 _dispatch_client_callout <null> (libdispatch.dylib:x86_64+0x3db4)

  Previous modifying access of NSMutableDictionary at 0x7b08002e6180 by main thread:
    #0 -[__NSDictionaryM removeObjectForKey:] <null> (CoreFoundation:x86_64+0x1912ef)
    #1 -[HWIFileDownloader handleSuccessfulDownloadToLocalFileURL:downloadItem:downloadID:] <null> (HWIFileDownload:x86_64+0x1a6fd)
    #2 -[HWIFileDownloader URLSession:task:didCompleteWithError:] <null> (HWIFileDownload:x86_64+0x105f9)
    #3 __51-[NSURLSession delegate_task:didCompleteWithError:]_block_invoke.182 <null> (CFNetwork:x86_64+0x1bf001)
    #4 _dispatch_client_callout <null> (libdispatch.dylib:x86_64+0x3db4)
    #5 start <null> (libdyld.dylib:x86_64+0x1540)

  Location is heap block of size 32 at 0x7b08002e6180 allocated by main thread:
    #0 calloc <null> (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x4a6b2)
    #1 class_createInstance <null> (libobjc.A.dylib:x86_64+0xf34f)
    #2 -[HWIFileDownloader initWithDelegate:maxConcurrentDownloads:] <null> (HWIFileDownload:x86_64+0x1b4b)
    #3 -[HWIFileDownloader initWithDelegate:] <null> (HWIFileDownload:x86_64+0x179f)
    #4 __40+[DVTemplateDownloadStore sharedManager]_block_invoke <null>
    #5 dispatch_once <null> (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x682d4)
    #6 +[DVTemplateDownloadStore sharedManager] <null>
    #7 -[TemplateModel isDownloaded] <null>
    #8 -[DVMainViewController initTemplateView] <null> 
    #9 -[DVMainViewController viewWillAppear:] <null>
    #10 -[UIViewController _setViewAppearState:isAnimating:] <null> (UIKitCore:x86_64+0x351436)
    #11 start <null> (libdyld.dylib:x86_64+0x1540)

  Thread T10 (tid=1095123, running) is a GCD worker thread

SUMMARY: ThreadSanitizer: race on NSMutableDictionary (/Applications/Xcode-10.2.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation:x86_64+0x19160b) in -[__NSDictionaryM setObject:forKey:]
==================

Not Resuming on Relaunch of Sample App

I was looking for this solution but I have download and Run this App for First time start download of 1.tiff & 2.tiff. Now put in Background and Terminate Application. Relaunch Application shows "Started with no progress". but doesn't start or resume download for some how.

How do I get download progress in Interrupted state

Thx for the Demo, I want the download progress to show on UI under below two condition

  • I started download and suppose after 50% download network goes disconnected then after I kill the app and relaunch the app In that case I want to show the download percentage But I get zero value in DemoDownloadItem object
  • 2nd one is the same above scenario but only change is when app gets crashed

Applicaton crash in real device

2016-05-14 14:58:57.921 HWIFileDownload[1521:635410] -[NSProgress setResumingHandler:]: unrecognized selector sent to instance 0x17012b220
2016-05-14 14:58:57.924 HWIFileDownload[1521:635410] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSProgress setResumingHandler:]: unrecognized selector sent to instance 0x17012b220'
*** First throw call stack:
(0x186e2259c 0x1975300e4 0x186e29664 0x186e26418 0x186d2ab6c 0x1000882d0 0x100087654 0x100084dc4 0x10007c0f4 0x18b608d34 0x18b5f1e48 0x18b6086d0 0x18b5c806c 0x18b6021f8 0x18b601898 0x18b5d4fa8 0x18b873f58 0x18b5d3510 0x186dda9ec 0x186dd9c90 0x186dd7d40 0x186d050a4 0x18feaf5a4 0x18b63a3c0 0x100086038 0x197b9ea08)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

redirect link dont work

hi,
after updating to 8.3
some download link that contain a redirect to direct link wont work ,

download progress lost

sometimes after i force close the app,
the download progress lost , and must start from beginning

file path

how i can get the downloaded file path, and how i can control the downloaded filename for the file that i want to download

Add to Cocoapods

Is there any chance of this to be added to Cocoapods? Or would you accept a PR that does this?

download timeout

in some case the download link expire after certain, time
could you plz add some notification logic maybe, so we can detect if the link sudnely become dead, or its not reponding so i can swtich the new download link

download local path changed

sometime the absoule local file of the downloaded change,
is that normal ,
how i can get the relative path for the file,
could you plz add a method that get get the newset localfile path

403 pages downloaded

Hi!
I am trying to find an elegant solution to prevent my app from downloading 403 pages instead of the right files. I saw in documentation there is an optional delegate method

- (BOOL)httpStatusCode:(NSInteger)aHttpStatusCode isValidForDownloadIdentifier:(nonnull NSString *)aDownloadIdentifier;

but I can not find it.
Any help will be useful.
Thanks!

New code not in v3.1 release

Hello @Heikowi

It seems to me that version 3.1 of this excellent library does not contain the new option to customize the urlRequest. The 3.1 tag is still on a much older commit than I think it was meant to. If this is intentional, I would love to see a release with the urlRequestForRemoteURL callback that works on all iOS versions.

Thanks in advance!

I want to set network type allowed for the download.

Hello @Heikowi ,

Can I implement the download manager in following way?
Like while starting download user can set allowed network type for the specific download item.

Such as wifi and cellular network.

So if the user has selected wifi only for one download item and user switches to cellular then the download will automatically get paused. And when we switch back to wifi so download will get started/resumed

Please let me know

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.