IOS 10.3 resumeData在第二次暂停

时间:2017-05-10 13:57:50

标签: ios swift nsurlsessiondownloadtask

我正在开发一个包含文件下载的IOS应用

文件下载在iOS 9.3上完全正常运行,但在iOS 10.3上,resumeData在第二次暂停时被破坏

我的流程步骤:

  1. 开始下载
  2. 暂停下载(打印并保留resumeData)
  3. 继续下载(在两台设备上都运行良好)
  4. 暂停下载(打印并保留resumeData)
  5. 继续下载(适用于9.3,不适用于10.3
  6. 设备上的ResumeData:

    IOS 9.3

      

    首次暂停

        NSURLSessionDownloadURL = "url_to_file.com";
    
        NSURLSessionResumeBytesReceived = 5741320;
    
        NSURLSessionResumeCurrentRequest = <62706c69 73743030 d4010203
    0405087c 7d542474 6f705824 6f626a65 63747358 24766572 73696f6e
    59246172 63686976 6572d106 0754726f 6f748001 af101b09 0a35474d
    4e555657 5836593c 5a5b6b6c 6d6e6f70 71727374 75785524 6e756c6c
    df101e0b 0c0d0e0f 10111213 14151617 18191a1b 1c1d1e1f 20212223
    24252627 28292a2b 2c2d2e2a 30312c33 2c35362b 2b2b3a29 3c3d2b36
    3f2b412b 3d444553 24313252 24335324 32355324 31375224 34532432
    31532431 33522435 53243138 52243653 24323253 2431345f 101e7265
    362e3055 656e2d75 73532a2f 2ad24f50 7677a277 535c4e53 44696374
    696f6e61 7279d24f 50797ba2 7a535c4e 5355524c 52657175 6573745c
    4e535552 4c526571 75657374 12000186 a05f100f 4e534b65 79656441
    72636869 76657200 08001100 16001f00 28003200 35003a00 3c005a00
    60009f00 a300a600 aa00ae00 b100b500 b900bc00 c000c300 c700cb00
    ec010901 0c011001 14011b01 1e012101 25012901 3c013f01 43014601
    4a014e01 51015501 57015901 5b015d01 5f016101 63016501 67016901
    6b016d01 6e017701 79017b01 7d017f01 81018301 85018701 89018b01
    8d018f01 91019301 95019601 9d01a901 b101b301 b501b702 55025a02
    63026e02 71027702 80028602 8f029102 92029402 9d02a102 a802b302
    bb02c102 c302c502 c702c902 cb02cd02 d302d502 d702d902 db02dd02
    e402f603 01031303 1a041904 27045304 59045d04 62046504 72047704
    7a048704 94049900 00000000 00020100 00000000 00007e00 00000000
    00000000 00000000 0004ab>;
    
        NSURLSessionResumeInfoTempFileName = "CFNetworkDownload_qHpzXu.tmp";
    
        NSURLSessionResumeInfoVersion = 2;
    
        NSURLSessionResumeOriginalRequest = <62706c69 73743030 d4010203
    04050851 52542474 6f705824 6f626a65 63747358 24766572 73696f6e
    59246172 63686976 6572d106 0754726f 6f748001 ac090a2d 3b414249
    4a4b2b4c 4d55246e 756c6cdf 10180b0c 0d0e0f10 11121314 15161718
    191a1b1c 1d1e1f20 21222324 25262428 29252b25 2d2e2e2e 31233334
    2b252e37 34395324 31325224 33532431 37522434 53243133 52243553
    24313852 24365f10 1a706179 6c6f6164 5472616e 736d6973 73696f6e
    54696d65 6f757453 2431345f 101e7265 71756972 65735368 6f727443
    6f6e6e65 6374696f 6e54696d 656f7574 52243753 24313953 24313056
    24636c61 73735224 38522430 53243135 5f101073 74617274 54696d65
    6f757454 696d6552 24395324 31315224 31532431 36522432 80088002
    80078003 80028006 800a8007 23000000 00000000 00800708 80008000
    8000800b 80081002 80098007 80001009 80091010 08d33c3d 193e2e40
    5b4e532e 72656c61 74697665 574e532e 62617365 80048000 80055f10
    9b687474 703a2f2f 62756c75 7464656d 6f2e6167 6d6c6162 2e636f6d
    2f76322f 66696c65 2f646f77 6e6c6f61 643f6861 73683d66 64326366
    62333838 38366239 62333333 61663265 33636439 63363061 61326326
    66696c65 49643d31 32363938 37266175 7468656e 74696369 7479546f
    6b656e3d 32306566 38646131 65656336 32353665 63646364 63393034
    37323438 36646365 63353230 62323031 d2434445 48582463 6c617373
    65735a24 636c6173 736e616d 65a24647 554e5355 524c584e 534f626a
    65637455 4e535552 4c23404e 00000000 00001000 0913ffff ffffffff
    ffffd243 444e50a2 4f475c4e 5355524c 52657175 6573745c 4e535552
    4c526571 75657374 12000186 a05f100f 4e534b65 79656441 72636869
    76657200 08001100 16001f00 28003200 35003a00 3c004900 4f008200
    86008900 8d009000 94009700 9b009e00 bb00bf00 e000e300 e700eb00
    f200f500 f800fc01 0f011201 16011901 1d012001 22012401 26012801
    2a012c01 2e013001 39013b01 3c013e01 40014201 44014601 48014a01
    4c014e01 50015201 54015501 5c016801 70017201 74017602 14021902
    22022d02 30023602 3f024502 4e025002 51025a02 5f026202 6f027c02
    81000000 00000002 01000000 00000000 53000000 00000000 00000000
    00000002 93>;
    
        NSURLSessionResumeServerDownloadDate = "Wed, Apr 26, 2017 11:05:41 AM GMT";
    
         

    第二次暂停

        NSURLSessionDownloadURL = "url_to_file.com";
    
        NSURLSessionResumeBytesReceived = 9918028;
    
        NSURLSessionResumeCurrentRequest = <62706c69 73743030 d4010203 4050884 
    85542474 6f705824 6f626a65 63747358 24766572 73696f6e 59246172 63686976
    6572d106 0754726f 6f748001 af101f09 0a35474d 4e555657 5836593c 5a5b6f70 
    71727374 75767778 797a7b7c 7d805524 6e756c6c df101e0b 0c0d0e0f 10111213 
    14151617 18191a1b 1c1d1e1f 20212223 24252627 28292a2b 2c2d2e2a 30312c33
    2c35362b 2b2b3a29 3c3d2b36 3f2b412b 3d444553 24313252 24335324 32355324 
    31375224 34532432 31532431 33522435 53243138 52243653 24323253 2431345f 
    101e7265 71756972 65735368 6f727443 6f6e6e65 6374696f 6e54696d 656f7574
    4e5f434f 4f4b4945 3d55656e 2d75735f 10215765 642c2041 70722032 362c2032 
    30313720 31313a30 353a3431 20414d20 474d545f 10294167 6d44656d 6f2f3120 
    43464e65 74776f72 6b2f3735 382e352e 33204461 7277696e 2f31352e 362e30d2 
    4f507e7f a27f535c 4e534469 6374696f 6e617279 d24f5081 83a28253 5c4e5355 
    524c5265 71756573 745c4e53 55524c52 65717565 73741200 0186a05f 100f4e53 
    4b657965 64417263 68697665 72000800 11001600 1f002800 32003500 3a003c00 
    5e006400 a300a700 aa00ae00 b200b500 b900bd00 c000c400 c700cb00 cf00f001 
    0d011001 14011801 1f012201 25012901 2d014001 43014701 4a014e01 52015501 
    59015b01 5d015f01 61016301 65016701 69016b01 6d016f01 71017201 7b017d01 
    7f018101 83018501 87018901 8b018d01 8f019101 93019501 97019901 9a01a101 
    ad01b501 b701b901 bb025902 5e026702 72027502 7b028402 8a029302 95029602 
    9802a102 a502ac02 b702bf02 c702c902 cb02cd02 cf02d102 d302d502 d702df02 
    e102e302 e502e702 e902eb02 ed02f303 05030c03 13032503 2e033903 48035603 
    5a045904 5f048304 af04b404 b704c404 c904cc04 d904e604 eb000000 00000002 
    01000000 00000000 86000000 00000000 00000000 00000004 fd>;
    
        NSURLSessionResumeInfoTempFileName = "CFNetworkDownload_qHpzXu.tmp";
    
        NSURLSessionResumeInfoVersion = 2;
    
        NSURLSessionResumeOriginalRequest = <62706c69 73743030 d4010203 04050851
    52542474 6f705824 6f626a65 63747358 24766572 73696f6e 59246172 63686976 
    6572d106 0754726f 6f748001 ac090a2d 3b414249 4a4b2b4c 4d55246e 756c6cdf 
    10180b0c 0d0e0f10 11121314 15161718 191a1b1c 1d1e1f20 21222324 25262428 
    29252b25 2d2e2e2e 31233334 2b252e37 34395324 31325224 33532431 37522434 
    53243133 52243553 24313852 24365f10 1a706179 6c6f6164 5472616e 736d6973 
    73696f6e 54696d65 6f757453 2431345f 101e7265 71756972 65735368 6f727443 
    6f6e6e65 6374696f 6e54696d 656f7574 52243753 24313953 24313056 24636c61 
    73735224 38522430 53243135 5f101073 74617274 54696d65 6f757454 696d6552 
    24395324 31315224 31532431 36522432 80088002 80078003 80028006 800a8007 
    23000000 00000000 00800708 80008000 8000800b 80081002 80098007 80001009 
    80091010 08d33c3d 193e2e40 5b4e532e 72656c61 74697665 574e532e 62617365 
    80048000 80055f10 9b687474 703a2f2f 62756c75 7464656d 6f2e6167 6d6c6162 
    2e636f6d 2f76322f 66696c65 2f646f77 6e6c6f61 643f6861 73683d66 64326366 
    62333838 38366239 62333333 61663265 33636439 63363061 61326326 66696c65 
    49643d31 32363938 37266175 7468656e 74696369 7479546f 6b656e3d 32306566 
    38646131 65656336 32353665 63646364 63393034 37323438 36646365 63353230 
    62323031 d2434445 48582463 6c617373 65735a24 636c6173 736e616d 65a24647 
    554e5355 524c584e 534f626a 65637455 4e535552 4c23404e 00000000 00001000 
    0913ffff ffffffff ffffd243 444e50a2 4f475c4e 5355524c 52657175 6573745c 
    4e535552 4c526571 75657374 12000186 a05f100f 4e534b65 79656441 72636869 
    76657200 08001100 16001f00 28003200 35003a00 3c004900 4f008200 86008900 
    8d009000 94009700 9b009e00 bb00bf00 e000e300 e700eb00 f200f500 f800fc01 
    0f011201 16011901 1d012001 22012401 26012801 2a012c01 2e013001 39013b01 
    3c013e01 40014201 44014601 48014a01 4c014e01 50015201 54015501 5c016801 
    70017201 74017602 14021902 22022d02 30023602 3f024502 4e025002 51025a02 
    5f026202 6f027c02 81000000 00000002 01000000 00000000 53000000 00000000 
    00000000 00000002 93
    
        NSURLSessionResumeServerDownloadDate = "Wed, Apr 26, 2017 11:05:41 AM GMT";
    

    IOS 10.3

      

    首次暂停

        NSURLSessionDownloadURL = "url_to_file.com";
    
        NSURLSessionResumeBytesReceived = 27242833;
    
        NSURLSessionResumeCurrentRequest = <62706c69 73743030 d4010203
    04050881 82542474 6f705824 6f626a65 63747358 24766572 73696f6e
    59246172 63686976 6572d106 075f101b 4e534b65 79656441 72636869
    7665526f 6f744f62 6a656374 4b657980 01af101b 090a3a49 4f50573c
    58593b5a 3e5b5c6c 6d6e6f70 71727374 75767c55 246e756c 6cdf101f
    0b0c0d0e 0f101112 13141516 1718191a 1b1c1d1e 1f202122 23242526
    2728292a 2b2c2d2e 2f302a2a 33302a36 372a2a3a 3b3c3d3e 3b2d2a2e
    42434345 2e475f10 205f5f6e 7375726c 72657175 6573745f 70726f74
    6f5f7072 6f705f6f 626a5f31 365f1020 5f5f6e73 75726c72 65717565
    73745f70 726f746f 5f70726f 705f6f62 6a5f3137 5f101f5f 5f6e7375
    726c7265 71756573 745f7072 6f746f5f 70726f70 5f6f626a 5f315f10
    1f5f5f6e 7375726c 72657175 6573745f 70726f74 6f5f7072 6f705f6f
    626a5f30 5f101f5f 5f6e7375 726c7265 71756573 745f7072 6f746f5f
    70726f70 5f6f626a 5f335f10 1f5f5f6e 7375726c 72657175 6573745f
    745f7072 6f746f5f 70726f70 5f6f626a 5f313580 00800c80 03800280
    07800680 08800080 00800980 08800080 0d800e80 00800008 23000000
    00000000 00100080 1a100280 02800080 07100980 0a800a10 16800780
    0b08d34a 4b1e4c2a 4e5b4e53 2e72656c 61746976 65574e53 2e626173
    65800480 0080055f 109b6874 74703a2f 2f62756c 75746465 6d6f2e61
    676d6c61 622e636f 6d2f7632 2f66696c 652f646f 776e6c6f 61643f68
    6173683d 66643263 66623338 38383662 39623333 33616632 65336364
    39633630 61613263 2666696c 6549643d 31323639 38372661 75746865
    6e746963 69747954 6f6b656e 3d343939 63326432 34313939 63383434
    38376662 39616137 36323362 32653735 63663062 39316331 38d25152
    53565824 636c6173 7365735a 24636c61 73736e61 6d65a254 55554e53
    55524c58 4e534f62 6a656374 554e5355 524c2340 4e000000 00000009
    100413ff ffffffff ffffff53 474554d3 5d1e5e5f 65665a4e 532e6f62
    6a656374 73574e53 2e6b6579 73a56061 62636480 14801580 16801780
    188019a5 6768696a 6b800f80 10801180 12801356 41636365 70745f10
    0f416363 6570742d 456e636f 64696e67 5a557365 722d4167 656e745f
    001f0028 00320035 00530055 00730079 00ba00dd 01000122 01440166
    018801aa 01cc01ee 02100232 02540277 029a02bd 02e00301 031e0335
    033c033f 03520375 039203b5 03b803db 03fe0401 04240447 0449044b
    044d044f 04510453 04550457 0459045b 045d045f 04610463 04650467
    04680471 04730475 04770479 047b047d 047f0481 04830485 04870489
    048a0491 049d04a5 04a704a9 04ab0549 054e0557 05620565 056b0574
    057a0583 05840586 058f0593 059a05a5 05ad05b3 05b505b7 05b905bb
    05bd05bf 05c505c7 05c905cb 05cd05cf 05d605e8 05f30605 060c0610
    061e064b 065107ad 07b207b6 07cc07d9 07e207f8 07fd0800 080d0816
    08230828 00000000 00000201 00000000 00000083 00000000 00000000
    00000000 0000083a>;
    
        NSURLSessionResumeInfoTempFileName = "CFNetworkDownload_W7CZsz.tmp";
    
        NSURLSessionResumeInfoVersion = 2;
    
        NSURLSessionResumeOriginalRequest = <62706c69 73743030 d4010203
    04050853 54542474 6f705824 6f626a65 63747358 24766572 73696f6e
    59246172 63686976 6572d106 075f101b 4e534b65 79656441 72636869
    7665526f 6f744f62 6a656374 4b657980 01ac090a 303d4344 4b2e4c2f
    4d4e5524 6e756c6c df10190b 0c0d0e0f 10111213 14151617 18191a1b
    1c1d1e1f 20212223 24252627 28292926 28292e2f 3031322f 29252636
    37373926 3b5f101f 5f5f6e73 75726c72 65717565 73745f70 726f746f
    5f70726f 705f6f62 6a5f315f 101f5f5f 6e737572 6c726571 75657374
    5f70726f 746f5f70 726f705f 6f626a5f 305f101f 5f5f6e73 75726c72
    65717565 73745f70 726f746f 5f70726f 705f6f62 6a5f335f 101f5f5f
    6e737572 6c726571 75657374 5f70726f 746f5f70 726f705f 6f626a5f
    325f101f 5f5f6e73 75726c72 65717565 73745f70 726f746f 5f70726f
    705f6f62 6a5f355f 101f5f5f 6e737572 6c726571 75657374 5f70726f
    746f5f70 726f705f 6f626a5f 345f101f 5f5f6e73 75726c72 65717565
    73745f70 726f746f 5f70726f 705f6f62 6a5f375f 101f5f5f 6e737572
    6c726571 75657374 5f70726f 746f5f70 726f705f 6f626a5f 365f101f
    5f5f6e73 75726c72 65717565 73745f70 726f746f 5f70726f 705f6f62
    6a5f395f 101f5f5f 6e737572 6c726571 75657374 5f70726f 746f5f70
    726f705f 6f626a5f 385f1014 616c6c6f 77656450 726f746f 636f6c54
    79706573 5f101a70 61796c6f 61645472 616e736d 69737369 6f6e5469
    6d656f75 745f101e 72657175 69726573 53686f72 74436f6e 6e656374
    696f6e54 696d656f 75745624 636c6173 73522430 5f101073 74617274
    54696d65 6f757454 696d655f 101a5f5f 6e737572 6c726571 75657374
    5f70726f 746f5f70 726f7073 5f10205f 5f6e7375 726c7265 71756573
    745f7072 6f746f5f 70726f70 5f6f626a 5f31305f 10205f5f 6e737572
    6c726571 75657374 5f70726f 746f5f70 726f705f 6f626a5f 31315224
    315f1020 5f5f6e73 75726c72 65717565 73745f70 726f746f 5f70726f
    705f6f62 6a5f3132 5f10205f 5f6e7375 726c7265 71756573 745f7072
    6f746f5f 70726f70 5f6f626a 5f313352 24325f10 205f5f6e 7375726c
    72657175 6573745f 70726f74 6f5f7072 6f705f6f 626a5f31 345f1020
    5f5f6e73 75726c72 65717565 73745f70 726f746f 5f70726f 705f6f62
    6a5f3135 80038002 80078006 80088000 80008007 80088000 10002300
    00000000 00000008 800b1002 80008002 80071009 80098009 10108007
    800a08d3 3e3f1840 29425b4e 532e7265 6c617469 7665574e 532e6261
    73658004 80008005 5f109b68 7474703a 2f2f6275 6c757464 656d6f2e
    61676d6c 61622e63 6f6d2f76 322f6669 6c652f64 6f776e6c 6f61643f
    68617368 3d666432 63666233 38383836 62396233 33336166 32653363
    64396336 30616132 63266669 6c654964 3d313236 39383726 61757468
    656e7469 63697479 546f6b65 6e3d3439 39633264 32343139 39633834
    34383766 62396161 37363233 62326537 35636630 62393163 3138d245
    46474a58 24636c61 73736573 5a24636c 6173736e 616d65a2 4849554e
    5355524c 584e534f 626a6563 74554e53 55524c23 404e0000 00000000
    0913ffff ffffffff ffffd245 464f52a2 50515c4e 5355524c 52657175
    65737458 4e534f62 6a656374 5c4e5355 524c5265 71756573 74120001
    86a05f10 0f4e534b 65796564 41726368 69766572 00080011 0016001f
    00280032 00350053 00550062 0068009d 00bf00e1 01030125 01470169
    018b01ad 01cf01f1 02080225 0246024d 02500263 028002a3 02c602c9
    02ec030f 03120335 0358035a 035c035e 03600362 03640366 0368036a
    036c036e 03770378 037a037c 037e0380 03820384 03860388 038a038c
    038e038f 039603a2 03aa03ac 03ae03b0 044e0453 045c0467 046a0470
    0479047f 04880489 04920497 049a04a7 04b004bd 04c20000 00000000
    02010000 00000000 00550000 00000000 00000000 00000000 04d4>;
    
        NSURLSessionResumeServerDownloadDate = "Wed, Apr 26, 2017 11:05:41 AM GMT";
    
         

    第二次暂停

        NSURLSessionDownloadURL = "url_to_file.com";
    
        NSURLSessionResumeBytesReceived = 56146972;
    
        NSURLSessionResumeCurrentRequest = <62706c69 73743030 d4010203
    04050889 8a542474 6f705824 6f626a65 63747358 24766572 73696f6e
    59246172 63686976 6572d106 075f101b 4e534b65 79656441 72636869
    7665526f 6f744f62 6a656374 4b657980 01af101f 090a3a49 4f50573c
    58593b5a 3e5b5c70 71727374 75767778 797a7b7c 7d7e8455 246e756c
    6cdf101f 0b0c0d0e 0f101112 13141516 1718191a 1b1c1d1e 1f202122
    23242526 2728292a 2b2c2d2e 2f302a2a 33302a36 372a2a3a 3b3c3d3e
    3b2d2a2e 42434345 2e475f10 205f5f6e 7375726c 72657175 6573745f
    70726f74 6f5f7072 6f705f6f 626a5f36 5f101f5f 5f6e7375 726c7265
    71756573 745f7072 6f746f5f 70726f70 5f6f626a 5f395f10 1f5f5f6e
    7375726c 72657175 6573745f 70726f74 6f5f7072 6f705f6f 626a5f38
    532e6f62 6a656374 73574e53 2e6b6579 73a76061 62636465 66801680
    17801880 19801a80 1b801c80 1da7696a 6b6c6d6e 6f800f80 10801180
    12801380 14801555 52616e67 655f100f 41636365 70742d45 6e636f64
    696e6756 41636365 70745643 6f6f6b69 655f100f 41636365 70742d4c
    616e6775 61676558 49662d52 616e6765 5a557365 722d4167 656e745f
    100f6279 7465733d 32373234 32383333 2d5d677a 69702c20 6465666c
    61746553 2a2f2a5f 11015842 554c5554 5f4c414e 473d7472 3b204255
    626c6544 69637469 6f6e6172 79d25152 8588a286 875c4e53 55524c52
    65717565 7374584e 534f626a 6563745c 4e535552 4c526571 75657374
    12000186 a05f100f 4e534b65 79656441 72636869 76657200 08001100
    16001f00 28003200 35005300 55007700 7d00be00 e1010401 26014801
    6a018c01 ae01d001 f2021402 36025802 7b029e02 c102e403 05032203
    39034003 43035603 79039603 b903bc03 df040204 05042804 4b044d04
    4f045104 53045504 57045904 5b045d04 5f046104 63046504 67046904
    6b046c04 75047704 79047b04 7d047f04 81048304 85048704 89048b04
    8d048e04 9504a104 a904ab04 ad04af05 4d055205 5b056605 69056f05
    78057e05 87058805 8a059305 97059e05 a905b105 b905bb05 bd05bf05
    c105c305 c505c705 c905d105 d305d505 d705d905 db05dd05 df05e505
    f705fe06 05061706 20062b06 3d064b06 4f07ab07 b107d508 02080708
    0b082108 2e083708 4d085208 55086208 6b087808 7d000000 00000002
    01000000 00000000 8b000000 00000000 00000000 00000008 8f>;
    
        NSURLSessionResumeInfoTempFileName = "CFNetworkDownload_W7CZsz.tmp";
    
        NSURLSessionResumeInfoVersion = 2;
    
        NSURLSessionResumeOriginalRequest = <62706c69 73743030 d4010203
    0405080a 0b542474 6f705824 6f626a65 63747358 24766572 73696f6e
    59246172 63686976 6572d106 075f101b 4e534b65 79656441 72636869
    7665526f 6f744f62 6a656374 4b657980 00a10955 246e756c 6c120001
    86a05f10 0f4e534b 65796564 41726368 69766572 0811161f 28323553
    55575d62 00000000 00000101 00000000 0000000c 00000000 00000000
    00000000 00000074>;
    
        NSURLSessionResumeServerDownloadDate = "Wed, Apr 26, 2017 11:05:41 AM GMT";
    
    • 由于尺寸限制,我缩短了“NSURLSessionResumeCurrentRequest”数据

    在IOS 10.3上“NSURLSessionResumeOriginalRequest”数据不同。

    我通过用正确的数据替换“NSURLSessionResumeOriginalRequest”数据来解决这个问题。

    但我认为这个解决方案可能会导致其他问题

    有没有人有这个问题的有效解决方案?

    Resume NSUrlSession on iOS10 这个问题不是这个问题的解决方案

0 个答案:

没有答案