Your download task has a link to the NSURLResponse *response
that was received as part of the download. This contains the MIMEType
that was set for the download. You should use that to determine what the file type is.
Technically you could read the first few bytes of data in the downloaded file but you would need a good amount of code to compare and identify all of the byte sequences...