iOS SDK
Last updated
2023-08-03 09:31:44
{"value":"Objective-C SDK \u4e3a\u5ba2\u6237\u7aef SDK\uff0c\u6ca1\u6709\u5305\u542b token \u751f\u6210\u5b9e\u73b0\uff0c\u4e3a\u4e86\u5b89\u5168\uff0ctoken \u90fd\u5efa\u8bae\u901a\u8fc7\u7f51\u7edc\u4ece\u670d\u52a1\u7aef\u83b7\u53d6 \u3002\u652f\u6301 Mac \u548c iOS\uff0c\u4f1a\u6839\u636e\u6587\u4ef6\u5927\u5c0f\u81ea\u52a8\u9009\u62e9\u8868\u5355\u4e0a\u4f20\u8fd8\u662f\u65ad\u70b9\u7eed\u4e0a\u4f20\u3002\n\n- [Objective-C SDK \u4e0b\u8f7d\u5730\u5740](https:\/\/github.com\/qiniu\/objc-sdk\/releases)\n- [Objective-C SDK \u6e90\u7801\u5730\u5740](https:\/\/github.com\/CDNCloudForU\/objc-sdk)\n- [Objective-C SDK \u5355\u5143\u6d4b\u8bd5](https:\/\/github.com\/CDNCloudForU\/objc-sdk\/tree\/master\/QiniuSDKTests)\n\n\n\n# \u5b89\u88c5\n\n\u4f7f\u7528 Cocoapods \u8fdb\u884c\u5b89\u88c5\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a\n\n```\npod \"Qiniu\", \"~> 8.4.1\"\n```\n\n\u901a\u8fc7 Swift Package Manager (Xcode 11+)\n\n```\nApp \u5bf9\u63a5:\nFile -> Swift Packages -> Add Package Dependency\uff0c\u8f93\u5165\u5e93\u94fe\u63a5\uff0c\u9009\u62e9\u76f8\u5e94\u7248\u672c\u5373\u53ef\u3002\n\u5e93\u94fe\u63a5: https:\/\/github.com\/qiniu\/objc-sdk\n\n\u5e93\u5bf9\u63a5:\nlet package = Package(\n dependencies: [\n .package(url: \"https:\/\/github.com\/qiniu\/objc-sdk\", from: \"8.4.1\")\n ],\n \/\/ ...\n)\n\n\u5e93\u5f15\u5165\u65b9\u5f0f\uff1a\nimport QiniuSDK\n```\n\n\n\n### \u8fd0\u884c\u73af\u5883\n\n| Qiniu SDK \u7248\u672c | \u6700\u4f4e iOS \u7248\u672c | \u6700\u4f4e OS X \u7248\u672c | Notes |\n| :----------------------- | :------------ | :------------- | :----------------- |\n| 8.4.x | iOS 7 | OS X 10.15 | Xcode \u6700\u4f4e\u7248\u672c 11. |\n| 8.3.x | iOS 7 | OS X 10.15 | Xcode \u6700\u4f4e\u7248\u672c 11. |\n| 8.2.x | iOS 7 | OS X 10.15 | Xcode \u6700\u4f4e\u7248\u672c 11. |\n| 8.1.x | iOS 7 | OS X 10.15 | Xcode \u6700\u4f4e\u7248\u672c 11. |\n| 8.0.x | iOS 7 | OS X 10.15 | Xcode \u6700\u4f4e\u7248\u672c 11. |\n| 7.4.x | iOS 7 | OS X 10.9 | Xcode \u6700\u4f4e\u7248\u672c 6. |\n| 7.3.x | iOS 7 | OS X 10.9 | Xcode \u6700\u4f4e\u7248\u672c 6. |\n| 7.2.x | iOS 7 | OS X 10.9 | Xcode \u6700\u4f4e\u7248\u672c 6. |\n| 7.1.x \/ AFNetworking-3.x | iOS 7 | OS X 10.9 | Xcode \u6700\u4f4e\u7248\u672c 6. |\n| 7.0.x \/ AFNetworking-2.x | iOS 6 | OS X 10.8 | Xcode \u6700\u4f4e\u7248\u672c 5. |\n| 7.x \/ AFNetworking-1.x | iOS 5 | OS X 10.7 | Xcode \u6700\u4f4e\u7248\u672c 5. |\n| 6.x | iOS 6 | None | Xcode \u6700\u4f4e\u7248\u672c 5. |\n\n**\u6ce8\u610f**\n\n- \u4ece 7.4.0 \u5f00\u59cb\u589e\u52a0\u4e86 DNS \u9884\u89e3\u6790\u548c\u7f13\u5b58\u7b56\u7565\uff08\u6bcf 2 \u5206\u949f\uff08\u8fdb\u7a0b\u975e\u6302\u8d77\u72b6\u6001\uff09\u4f1a\u81ea\u52a8\u5237\u65b0\u7f13\u5b58\u7b56\u7565\uff09\uff0c\u51cf\u5c11 DNS \u89e3\u6790\u9519\u8bef\u3002\u9ed8\u8ba4\u9884\u89e3\u6790\u5f00\u542f\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e kQNGlobalConfiguration.isDnsOpen = false \u5173\u95ed\u8be5\u529f\u80fd\u3002\n- \u4ece 8.3.1 \u7248\u672c\u5f00\u59cb\u652f\u6301\u8bbe\u7f6e\u7f13\u5b58\u6709\u6548\u671f\uff0c\u9ed8\u8ba4 10 \u5206\u949f\uff0c\u53ef\u4fee\u6539 kQNGlobalConfiguration.dnsCacheMaxTTL \u7684\u503c\uff0c\u5355\u4f4d\u4e3a s\u3002\n\n\n\n# \u5b89\u5168\u673a\u5236\n\n\u8be5 SDK \u672a\u5305\u542b\u51ed\u8bc1\u751f\u6210\u76f8\u5173\u7684\u529f\u80fd\u3002\u5f00\u53d1\u8005\u5bf9\u5b89\u5168\u6027\u7684\u63a7\u5236\u5e94\u9075\u5faa \u5b89\u5168\u673a\u5236\u4e2d\u5efa\u8bae\u7684\u505a\u6cd5\uff0c\u5373\u5ba2\u6237\u7aef\u5e94\u5411\u4e1a\u52a1\u670d\u52a1\u5668\u6bcf\u9694\u4e00\u6bb5\u65f6\u95f4\u8bf7\u6c42 \u4e0a\u4f20\u51ed\u8bc1]\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u5728\u5ba2\u6237\u7aef\u4f7f\u7528 AccessKey \/ SecretKey \u751f\u6210\u5bf9\u5e94\u7684\u51ed\u8bc1\u3002\u5728\u5ba2\u6237\u7aef\u4f7f\u7528 SecretKey \u4f1a\u5bfc\u81f4\u4e25\u91cd\u7684\u5b89\u5168\u9690\u60a3\u3002\n\n\u5f00\u53d1\u8005\u53ef\u4ee5\u5728\u751f\u6210\u4e0a\u4f20\u51ed\u8bc1\u524d\u901a\u8fc7\u914d\u7f6e \u4e0a\u4f20\u7b56\u7565)\u6765\u63a7\u5236\u4e0a\u4f20\u7684\u540e\u7eed\u52a8\u4f5c\uff0c\u4f8b\u5982\u5728\u4e0a\u4f20\u5b8c\u6210\u540e\u901a\u8fc7\u56de\u8c03\u673a\u5236\u901a\u77e5\u4e1a\u52a1\u670d\u52a1\u5668\u3002\u8be5\u5de5\u4f5c\u5728\u4e1a\u52a1\u670d\u52a1\u5668\u7aef\u8fdb\u884c\uff0c\u56e0\u6b64\u975e\u672c SDK \u7684\u529f\u80fd\u8303\u7574\u3002\n\n\u5b58\u50a8\u7684\u670d\u52a1\u7aef SDK \u63d0\u4f9b\u4e86\u4e0a\u4f20\u51ed\u8bc1\u7684\u751f\u6210\u529f\u80fd\uff0c\u8bf7\u53c2\u8003\u5404\u4e2a\u670d\u52a1\u7aef\u8bed\u8a00\u7684 SDK \u6587\u6863\u3002\n\n\n\n# \u4e0a\u4f20\n\nSDK \u5185\u7f6e\u4e24\u79cd\u4e0a\u4f20\u65b9\u5f0f\uff1a\u8868\u5355\u4e0a\u4f20\u548c\u5206\u7247\u4e0a\u4f20\uff0c\u5e76\u6839\u636e\u5177\u4f53\u60c5\u51b5\uff0c\u5185\u90e8\u505a\u4e86\u81ea\u52a8\u5207\u6362\u3002\u8868\u5355\u4e0a\u4f20\u4f7f\u7528\u4e00\u4e2a HTTP POST \u8bf7\u6c42\u5b8c\u6210\u6587\u4ef6\u7684\u4e0a\u4f20\uff0c\u56e0\u6b64\u6bd4\u8f83\u9002\u5408\u8f83\u5c0f\u7684\u6587\u4ef6\u548c\u8f83\u597d\u7684\u7f51\u7edc\u73af\u5883\u3002\u76f8\u6bd4\u800c\u8a00\uff0c\u5206\u7247\u4e0a\u4f20\u66f4\u80fd\u9002\u5e94\u4e0d\u7a33\u5b9a\u7684\u7f51\u7edc\u73af\u5883\uff0c\u4e5f\u6bd4\u8f83\u9002\u5408\u4e0a\u4f20\u6bd4\u8f83\u5927\u7684\u6587\u4ef6\uff08\u4f8b\u5982\u6570\u767e MB \u6216\u66f4\u5927\uff09\u3002\n\n\u82e5\u9700\u6df1\u5165\u4e86\u89e3\u4e0a\u4f20\u65b9\u5f0f\u4e4b\u95f4\u7684\u533a\u522b\uff0c\u8bf7\u53c2\u9605\u4e0a\u4f20\u7c7b\u578b\u4e2d \u8868\u5355\u4e0a\u4f20\u3001\u5206\u7247\u4e0a\u4f20 v1 \u7248\u548c \u5206\u7247\u4e0a\u4f20 v2 \u7248 \u63a5\u53e3\u8bf4\u660e\u3002\n\n```objectivec\n#import <QiniuSDK.h>\n...\nNSString *token = @\"\u4ece\u670d\u52a1\u7aefSDK\u83b7\u53d6\";\nQNUploadManager *upManager = [[QNUploadManager alloc] init];\nNSData *data = [@\"Hello, World!\" dataUsingEncoding : NSUTF8StringEncoding];\n[upManager putData:data key:@\"hello\" token:token\ncomplete: ^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {\n NSLog(@\"%@\", info);\n NSLog(@\"%@\", resp);\n} option:nil];\n...\n```\n\n**\u6ce8\u610f\uff1a**key \u53ca\u6240\u6709\u9700\u8981\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u5fc5\u987b\u91c7\u7528 utf8 \u7f16\u7801\uff0c\u5982\u679c\u4f7f\u7528\u975e utf8 \u7f16\u7801\u8bbf\u95ee \u79c1\u6709\u4e91\u5b58\u50a8 \u5c06\u53cd\u9988\u9519\u8bef\u3002\n\n**option**\n\n\u5173\u4e8e option \u53c2\u6570\uff0c\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u5ffd\u7565 put \u65b9\u6cd5\u4e2d\u7684 option \u53c2\u6570\uff0c\u5373\u5728\u8c03\u7528\u65f6\u4fdd\u6301 option \u7684\u503c\u4e3a nil \u5373\u53ef\u3002\u4f46\u5bf9\u4e8e\u4e00\u4e9b\u7279\u6b8a\u7684\u573a\u666f\uff0c\u6211\u4eec\u53ef\u4ee5\u7ed9 option \u4f20\u5165\u4e00\u4e9b\u9ad8\u7ea7\u9009\u9879\u4ee5\u66f4\u7cbe\u786e\u7684\u63a7\u5236\u4e0a\u4f20\u884c\u4e3a\u548c\u83b7\u53d6\u8fdb\u5ea6\u4fe1\u606f\u3002option QNUploadOption \u7c7b\u578b\u5305\u542b\u7684\u53d8\u91cf\u6709\uff1aparams\u3001mimeType\u3001checkCrc\u3001progressHandler\u3001cancelSignal\u3002\n\n**params**\n\n\u7528\u6237\u81ea\u5b9a\u4e49\u53c2\u6570\uff0c\u5fc5\u987b\u4ee5 `x:` \u5f00\u5934\uff0c\u8fd9\u4e9b\u53c2\u6570\u53ef\u4ee5\u4f5c\u4e3a\u53d8\u91cf\u7528\u4e8e upToken \u7684 callbackBody\u3001returnBody\u3001asyncOps \u53c2\u6570\u4e2d\uff0c\u5177\u4f53\u4fe1\u606f\u8bf7\u53c2\u9605[\u81ea\u5b9a\u4e49\u53d8\u91cf\u3002 \u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\u5982\u4e0b\uff1a\n\n```objectivec\nQNUploadOption *opt = [[QNUploadOption alloc] initWithMime:@\"text\/plain\" progressHandler:nil params:@{ @\"x:foo\":@\"fooval\" } checkCrc:YES cancellationSignal:nil];\n[upManager putData:data key:@\"hello\" token:token\ncomplete: ^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {\n NSLog(@\"%@\", info);\n NSLog(@\"%@\", resp);\n} option:opt];\n```\n\n**mimeType**\n\n\u4e3a\u4e0a\u4f20\u6587\u4ef6\u8bbe\u7f6e\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684 MIME \u7c7b\u578b\uff0c\u5982\u679c\u4e3a\u7a7a\uff0c\u90a3\u4e48\u670d\u52a1\u7aef\u81ea\u52a8\u68c0\u6d4b\u6587\u4ef6\u7684 MIME \u7c7b\u578b\u3002\n\n**checkCrc**\n\ncheckCrc \u4e3a NO \u65f6\uff0c\u670d\u52a1\u7aef\u4e0d\u4f1a\u6821\u9a8c crc32 \u503c\uff0ccheckCrc \u4e3a YES \u65f6\uff0c\u670d\u52a1\u7aef\u4f1a\u8ba1\u7b97\u4e0a\u4f20\u6587\u4ef6\u7684 crc32 \u503c\uff0c\u7136\u540e\u4e0e\u7528\u6237\u63d0\u4f9b\u7684 crc32 \u53c2\u6570\u503c\u6bd4\u8f83\u786e\u8ba4\u6587\u4ef6\u7684\u5b8c\u6574\u6027\uff0c\u5982\u679c\u6821\u9a8c\u5931\u8d25\u4f1a\u8fd4\u56de 406 \u9519\u8bef\u3002\n\n\n\n## \u7b80\u5355\u4e0a\u4f20\n\n```\n\/\/\u9009\u62e9\u6700\u65b0\u7684\u5206\u7247\u4e0a\u4f20\u7248\u672c\nQNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {\n builder.resumeUploadVersion = QNResumeUploadVersionV2;\n}];\n\n\/\/\u56fd\u5185https\u4e0a\u4f20\nQNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {\n builder.useHttps = YES;\n}];\n\n\/\/\u534e\u4e1c\nQNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {\n builder.zone = [QNFixedZone zone0];\n}];\n\n\/\/\u534e\u5317\nQNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {\n builder.zone = [QNFixedZone zone1];\n}];\n\n\/\/\u534e\u5357\nQNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {\n builder.zone = [QNFixedZone zone2];\n}];\n\n\/\/\u5317\u7f8e\nQNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {\n builder.zone = [QNFixedZone zoneNa0];\n}];\n\n\/\/\u6d77\u5916https\u4e0a\u4f20\nQNConfiguration * config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {\n builder.zone = [QNFixedZone zoneNa0];\n builder.useHttps = YES;\n}];\n\n\/\/\u91cd\u7528uploadManager\u3002\u4e00\u822c\u5730\uff0c\u53ea\u9700\u8981\u521b\u5efa\u4e00\u4e2auploadManager\u5bf9\u8c61\nNSString * token = @\"\u4ece\u670d\u52a1\u7aefSDK\u83b7\u53d6\";\nNSString * key = @\"\u6307\u5b9a\u5b58\u50a8\u670d\u52a1\u4e0a\u7684\u6587\u4ef6\u540d\uff0c\u6216nil\";\nNSString * filePath = @\"\u8981\u4e0a\u4f20\u7684\u6587\u4ef6\u8def\u5f84\";\nQNUploadManager *upManager = [[QNUploadManager alloc] initWithConfiguration:config];\n[upManager putFile:filePath key:key token:token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {\n if(info.ok)\n {\n NSLog(@\"\u8bf7\u6c42\u6210\u529f\");\n }\n else{\n NSLog(@\"\u5931\u8d25\");\n \/\/\u5982\u679c\u5931\u8d25\uff0c\u8fd9\u91cc\u53ef\u4ee5\u628ainfo\u4fe1\u606f\u4e0a\u62a5\u81ea\u5df1\u7684\u670d\u52a1\u5668\uff0c\u4fbf\u4e8e\u540e\u9762\u5206\u6790\u4e0a\u4f20\u9519\u8bef\u539f\u56e0\n }\n NSLog(@\"info ===== %@\", info);\n NSLog(@\"resp ===== %@\", resp);\n} option:nil];\n```\n\n**\u6ce8\u610f**\uff1a 7.1.4\u7248\u672c\u4e4b\u540e, \u53ef\u81ea\u52a8\u5224\u65ad\u4e0a\u4f20\u7a7a\u95f4\uff0c\u4e0d\u8bbe\u7f6eQNConfiguration\u7684zone\u53c2\u6570\u5373\u53ef\uff1a\n\n```\nQNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {\n builder.useHttps = YES;\n}];\nQNUploadManager *upManager = [[QNUploadManager alloc] initWithConfiguration:config];\n```\n\n\n\n## \u4e0a\u4f20\u8fdb\u5ea6\n\n\u4e0a\u4f20\u8fdb\u5ea6\u7684 block \u4e3a\uff1a\n\n```\ntypedef void (^QNUpProgressHandler)(NSString *key, float percent);\n```\n\n\u5982\u679c\u5b9e\u73b0\u4e86\u8fd9\u4e2a block\uff0c\u5e76\u4f5c\u4e3a option \u53c2\u6570\u4f20\u5165\uff0c\u4f1a\u53ca\u65f6\u5f97\u5230\u4e0a\u4f20\u8fdb\u5ea6\u901a\u77e5\u3002\n\n\n\n## \u53d6\u6d88\u4e0a\u4f20\n\n\u5982\u679c\u5e0c\u671b\u4e2d\u9014\u53ef\u4ee5\u53d6\u6d88\u4e0a\u4f20\uff0c\u9700\u8981\u5b9e\u73b0\u4e0b\u9762\u7684 block\uff0c\u5e76\u4f5c\u4e3a\u53c2\u6570\u4f20\u5165 option\uff1a\n\n```\ntypedef BOOL (^QNUpCancellationSignal)(void);\n```\n\n\u5f53\u6267\u884c\u53d6\u6d88\u64cd\u4f5c\u65f6\uff0c\u8ba9\u8fd9\u4e2a\u51fd\u6570\u8fd4\u56de YES\uff0c\u8fd9\u6837\u4e0a\u4f20\u4e2d\u9014\u5373\u53ef\u505c\u6b62\uff0c\u5177\u4f53\u8bf7\u53c2\u8003 [QNFileRecorderTest.m](https:\/\/github.com\/CDNCloudForU\/objc-sdk\/blob\/master\/QiniuSDKTests\/QNFileRecorderTest.m) \u6d4b\u8bd5\u4e2d\u7684\u4f8b\u5b50\u3002\n\n\n\n## \u65ad\u70b9\u7eed\u4e0a\u4f20\n\n\u672c SDK \u5b9e\u73b0\u4e86\u65ad\u70b9\u7eed\u4e0a\u4f20\uff0c\u5982\u679c\u9700\u8981\u4fdd\u5b58\u4e0a\u4f20\u8fdb\u5ea6\uff0c\u9700\u8981\u60a8\u5728\u751f\u6210 UploaderManager \u5b9e\u4f8b\u65f6\u4f20\u5165\u4e00\u4e2a\u5b9e\u73b0\u4fdd\u5b58\u8fdb\u5ea6\u7684\u4ee3\u7406\uff0cSDK \u81ea\u5e26\u4e86\u5c06\u8fdb\u5ea6\u4fdd\u5b58\u8fdb\u6587\u4ef6\u7684\u65b9\u6cd5\uff0c\u60a8\u53ef\u4ee5\u81ea\u5df1\u5b9e\u73b0\u5176\u4ed6\u4fdd\u5b58\u65b9\u5f0f\u3002\u5177\u4f53\u8bf7\u53c2\u8003 [QNFileRecorderTest.m](https:\/\/github.com\/CDNCloudForU\/objc-sdk\/blob\/master\/QiniuSDKTests\/QNFileRecorderTest.m) \u6d4b\u8bd5\u4e2d\u7684\u4f8b\u5b50\u3002\n\n```objectivec\nNSError *error;\nQNFileRecorder *file = [QNFileRecorder fileRecorderWithFolder:@\"\u4fdd\u5b58\u76ee\u5f55\" error:&error];\n\/\/check error\nQNUploadManager *upManager = [[QNUploadManager alloc] initWithRecorder:file];\n```\n\n\n\n## \u5206\u7247\u4e0a\u4f20\n\nSDK \u4ece v7.3.0 \u5f00\u59cb\u652f\u6301\u5e76\u884c\u5206\u7247\u4e0a\u4f20\uff0c\u4e0a\u4f20\u4ee3\u7801\u53ef\u4ee5\u53c2\u8003 [QNConcurrentResumeUploadTest.m](https:\/\/github.com\/CDNCloudForU\/objc-sdk\/blob\/master\/QiniuSDKTests\/QNConcurrentResumeUploadTest.m)\u3002\n\n\u53ef\u4ee5\u9009\u62e9\u5206\u7247\u4e0a\u4f20\u7248\u672c\uff0c\u63a8\u8350 QNResumeUploadVersionV2\uff0c\u8868\u793a\u5206\u7247\u4e0a\u4f20 v2 \u7248\uff0c\u9ed8\u8ba4QNResumeUploadVersionV1\uff0c\u8868\u793a\u5206\u7247\u4e0a\u4f20 v1 \u7248\uff0c\u517c\u5bb9\u5386\u53f2\u60c5\u51b5\u3002\n\n```objectivec\nQNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {\n builder.resumeUploadVersion = QNResumeUploadVersionV2; \/\/ \u9009\u62e9\u5206\u7247\u4e0a\u4f20\u7248\u672c\n builder.useConcurrentResumeUpload = YES; \/\/ \u5f00\u542f\u5e76\u53d1\u4e0a\u4f20\uff0c\u9ed8\u8ba4\u4e3a NO\n builder.concurrentTaskCount = 3; \/\/ \u9ed8\u8ba4\u5e76\u884c\u7ebf\u7a0b\u6570\u4e3a 3\n\n}];\nQNUploadManager *upManager = [[QNUploadManager alloc] initWithConfiguration:config];\n```\n\n## inputStream \u6d41\u4e0a\u4f20\n\nSDK \u4ece v8.3.0 \u5f00\u59cb\u652f\u6301 inputStream \u6d41\u4e0a\u4f20\u3002\n\n```\nNSInputStream *inputStream = nil; \/\/ file input stream\nNSString *sourceId = @\"\"; \/\/ source \u4f5c\u4e3a\u65ad\u70b9\u7eed\u4f20\u7684\u6807\u8bc6\uff0c\u4fdd\u8bc1\u6bcf\u4e2a\u6587\u4ef6\u4e0d\u540c\nlong long size = -1; \/\/ input stream \u5927\u5c0f\uff0c\u4e0d\u77e5\u9053\u65f6\u4e3a -1\uff0csize \u5bf9progress \u8fdb\u5ea6\u6709\u5f71\u54cd\nNSString *key = @\"\"; \/\/ \u5b58\u50a8\u7684key\nNSString *token = @\"\"; \/\/ \u4e03\u725btoken\n[upManager putInputStream:inputStream sourceId:sourceId size:size fileName:key key:key token:token complete:^(QNResponseInfo *info, NSString *k, NSDictionary *resp) {\n\n} option:option];\n```\n\n\n\n# \u5e38\u89c1\u95ee\u9898\n\n- \u5982\u679c\u78b0\u5230 crc \u94fe\u63a5\u9519\u8bef\uff0c\u8bf7\u628a libz.dylib \u52a0\u5165\u5230\u9879\u76ee\u4e2d\u53bb\u3002\n- \u5982\u679c\u78b0\u5230 res_9_ninit \u94fe\u63a5\u9519\u8bef\uff0c\u8bf7\u628a libresolv.dylib \u52a0\u5165\u5230\u9879\u76ee\u4e2d\u53bb\u3002\n- \u5982\u679c\u9700\u8981\u652f\u6301 iOS 5 \u6216\u8005\u652f\u6301 RestKit\uff0c\u8bf7\u7528 AFNetworking 1.x \u5206\u652f\u7684\u7248\u672c\u3002\n- \u5982\u679c\u78b0\u5230\u5176\u4ed6\u7f16\u8bd1\u9519\u8bef\uff0c\u8bf7\u53c2\u8003 Cocoapods \u7684[troubleshooting](http:\/\/guides.cocoapods.org\/using\/troubleshooting.html)\u3002\n- iOS 9+ \u5f3a\u5236\u4f7f\u7528 https \uff0c\u9700\u8981\u5728 project build info \u6dfb\u52a0 NSAppTransportSecurity \u7c7b\u578b Dictionary\u3002\u5728 NSAppTransportSecurity\u4e0b\u6dfb\u52a0 NSAllowsArbitraryLoads \u7c7b\u578b Boolean \uff0c\u503c\u8bbe\u4e3a YES\u3002\u5177\u4f53\u64cd\u4f5c\u8bf7\u67e5\u9605[\u8fd9\u91cc](http:\/\/blog.csdn.net\/guoer9973\/article\/details\/48622823)\u3002\n\n\n\n# \u8d21\u732e\u4ee3\u7801\n\n1. Fork\n2. \u521b\u5efa\u60a8\u7684\u7279\u6027\u5206\u652f git checkout -b my-new-feature\n3. \u63d0\u4ea4\u60a8\u7684\u6539\u52a8 git commit -am 'Added some feature'\n4. \u5c06\u60a8\u7684\u4fee\u6539\u8bb0\u5f55\u63d0\u4ea4\u5230\u8fdc\u7a0b git \u4ed3\u5e93 git push origin my-new-feature\n5. \u7136\u540e\u5230 github \u7f51\u7ad9\u7684\u8be5 git \u8fdc\u7a0b\u4ed3\u5e93\u7684 my-new-feature \u5206\u652f\u4e0b\u53d1\u8d77 Pull Request"}