我想将文件上传到Azure Iot Hub Blob。我找到了API:
IoTHubClient_LL_UploadToBlob
但是当我仅这样做时,它将报告一个错误:
有我的代码。 data是iOS数据结构,可以是图像或音频。
let source = UnsafePointer<UInt8>((data as NSData).bytes.assumingMemoryBound(to: UInt8.self))
if (IoTHubClient_LL_UploadToBlob(iotHubClientHandle, "iOS/\(filename)", source, data.count)) != IOTHUB_CLIENT_OK {
print("failed to upload \(filename)")
} else {
print("success to upload \(filename)")
}
我明白了:
Info: unknown option CURLOPT_VERBOSE
Error: Time:Tue Aug 21 10:06:38 2018 File:/Users/ltp1994/Development/azure-iot-samples-ios/quickstart/sample-device/Pods/AzureIoTUtility/src/httpapiex.c Func:HTTPAPIEX_SetOption Line:609 error code = HTTPAPIEX_INVALID_ARG
Info: Waiting for TLS connection
Info: Waiting for TLS connection
Info: Waiting for TLS connection
Error: Time:Tue Aug 21 10:06:40 2018 File:/Users/ltp1994/Development/azure-iot-samples-ios/quickstart/sample-device/Pods/AzureIoTHubClient/iothub_client/src/iothub_client_ll_uploadtoblob.c Func:IoTHubClient_LL_UploadToBlob_step1and2 Line:417 HTTP code was 400
Error: Time:Tue Aug 21 10:06:40 2018 File:/Users/ltp1994/Development/azure-iot-samples-ios/quickstart/sample-device/Pods/AzureIoTHubClient/iothub_client/src/iothub_client_ll_uploadtoblob.c Func:IoTHubClient_LL_UploadMultipleBlocksToBlob_Impl Line:940 error in IoTHubClient_LL_UploadToBlob_step1
failed to upload iOSImageTest2.png
我应该做其他事情吗?也许发送POST请求以获取SAS令牌?
请举个例子。