我需要一些帮助来理解我做错了什么。
我正在尝试使用IOS的OneDrive API在iphone(或模拟器)中下载最初在MS oneDrive中的文件。我正确认证,因为我能够列出文件和目录。
下载具有给定fileid的文件的代码如下:
- (void) loadFolderContent
{
[self.liveClient getWithPath:@"file.3f40e27093d2e59e.3F40E27093D2E59E!306"
delegate:self
userState:@"load-file-content"];
}
- (void) liveOperationSucceeded:(LiveOperation *)operation
{
if ([operation.userState isEqual:@"load-file-content"])
{
LiveDownloadOperation *downloadOp = (LiveDownloadOperation *)operation;
[downloadOp.data writeToFile:@"example.pdf" atomically:YES];
}
}
文件路径file.3f40e27093d2e59e.3F40E27093D2E59E!306是文件的fileID,所以应该没问题
它在这一行崩溃了:
[downloadOp.data writeToFile:@"example.pdf" atomically:YES]
downloadOp.data存在且不是nil,但我仍然收到错误:
-[LiveOperation data]: unrecognized selector sent to instance 0xacde910
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[LiveOperation data]: unrecognized selector sent to instance 0xacde910'
*** First throw call stack:
(
0 CoreFoundation 0x028881e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x026078e5 objc_exception_throw + 44
2 CoreFoundation 0x02925243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0287850b ___forwarding___ + 1019
4 CoreFoundation 0x028780ee _CF_forwarding_prep_0 + 14
5 DemoApp 0x000410f3 -[CFFlipsideViewController liveOperationSucceeded:] + 515
6 DemoApp 0x00050ed7 -[LiveOperationCore operationCompleted] + 335
7 DemoApp 0x00051060 -[LiveOperationCore connectionDidFinishLoading:] + 35
8 Foundation 0x023d0e49 ___NSURLConnectionDidFinishLoading_block_invoke + 40
9 Foundation 0x023677e1 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 62
10 Foundation 0x021eff5e -[NSURLConnectionInternalConnection invokeForDelegate:] + 119
11 Foundation 0x021efec6 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 208
12 Foundation 0x021efdd8 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 76
13 Foundation 0x021f0188 _NSURLConnectionDidFinishLoading + 43
14 CFNetwork 0x02d1869f ___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 111
15 CFNetwork 0x02d163de ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 104
16 CoreFoundation 0x02829c69 CFArrayApplyFunction + 57
17 CFNetwork 0x02c7f441 _ZN19RunloopBlockContext7performEv + 155
18 CFNetwork 0x02d613f4 _ZThn16_N19RunloopBlockContext24multiplexerClientPerformEv + 20
19 CFNetwork 0x02c7f257 _ZN17MultiplexerSource7performEv + 299
20 CFNetwork 0x02c7f06c _ZN17MultiplexerSource8_performEPv + 76
21 CoreFoundation 0x0281177f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
22 CoreFoundation 0x0281110b __CFRunLoopDoSources0 + 235
23 CoreFoundation 0x0282e1ae __CFRunLoopRun + 910
24 CoreFoundation 0x0282d9d3 CFRunLoopRunSpecific + 467
25 CoreFoundation 0x0282d7eb CFRunLoopRunInMode + 123
26 GraphicsServices 0x039785ee GSEventRunModal + 192
27 GraphicsServices 0x0397842b GSEventRun + 104
28 UIKit 0x012c7f9b UIApplicationMain + 1225
)
感谢您解决此问题的任何帮助。
谢谢, DOM