2012-02-16 4 views
0

Phonegap에서 내 iOS 앱을 사용하여 사진을 업로드하는 중에 문제가 있습니다. 오류 :iOS 업로드 사진

2012-02-16 19:06:17.523 ContactExplorer[851:207] File Transfer Error: Invalid server URL 
2012-02-16 19:06:17.623 ContactExplorer[851:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: target)' 
*** Call stack at first throw: 
(
    0 CoreFoundation      0x01dfb5a9 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x01f4f313 objc_exception_throw + 44 
    2 CoreFoundation      0x01db3ef8 +[NSException raise:format:arguments:] + 136 
    3 CoreFoundation      0x01db3e6a +[NSException raise:format:] + 58 
    4 CoreFoundation      0x01df9e15 -[__NSCFDictionary setObject:forKey:] + 293 
    5 ContactExplorer      0x00021990 -[PGFileTransfer createFileTransferError:AndSource:AndTarget:] + 153 
    6 ContactExplorer      0x00020c0b -[PGFileTransfer upload:withDict:] + 717 
    7 ContactExplorer      0x000157bf -[PhoneGapDelegate execute:] + 434 
    8 ContactExplorer      0x000029f0 -[AppDelegate execute:] + 80 
    9 ContactExplorer      0x000151e4 -[PhoneGapDelegate executeQueuedCommands] + 265 
    10 ContactExplorer      0x00015291 -[PhoneGapDelegate flushCommandQueue] + 81 
    11 ContactExplorer      0x00015600 -[PhoneGapDelegate webView:shouldStartLoadWithRequest:navigationType:] + 822 
    12 ContactExplorer      0x00002d3c -[AppDelegate webView:shouldStartLoadWithRequest:navigationType:] + 108 
    13 UIKit        0x00a93a92 -[UIWebView webView:decidePolicyForNavigationAction:request:frame:decisionListener:] + 291 
    14 CoreFoundation      0x01d6bc7d __invoking___ + 29 
    15 CoreFoundation      0x01d6bb51 -[NSInvocation invoke] + 145 
    16 CoreFoundation      0x01d99858 -[NSInvocation invokeWithTarget:] + 72 
    17 WebKit        0x0283cc76 -[_WebSafeForwarder forwardInvocation:] + 182 
    18 CoreFoundation      0x01d6ca04 ___forwarding___ + 1124 
    19 CoreFoundation      0x01d6c522 _CF_forwarding_prep_0 + 50 
    20 CoreFoundation      0x01d6bc7d __invoking___ + 29 
    21 CoreFoundation      0x01d6bb51 -[NSInvocation invoke] + 145 
    22 WebCore        0x03330150 _ZL20HandleDelegateSourcePv + 64 
    23 CoreFoundation      0x01ddc8ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 
    24 CoreFoundation      0x01d3a88b __CFRunLoopDoSources0 + 571 
    25 CoreFoundation      0x01d39d86 __CFRunLoopRun + 470 
    26 CoreFoundation      0x01d39840 CFRunLoopRunSpecific + 208 
    27 CoreFoundation      0x01d39761 CFRunLoopRunInMode + 97 
    28 GraphicsServices     0x023781c4 GSEventRunModal + 217 
    29 GraphicsServices     0x02378289 GSEventRun + 115 
    30 UIKit        0x0090ac93 UIApplicationMain + 1160 
    31 ContactExplorer      0x0000246f main + 127 
    32 ContactExplorer      0x000023e5 start + 53 
    33 ???         0x00000001 0x0 + 1 
) 
terminate called after throwing an instance of 'NSException' 

나는 googled하지만 key : target에 대한 설명이 나와 있지 않습니다.

답변

4

자세히 Close :

[__NSCFDictionary의 setObject : forKey :] : (: 목표 키) 당신은 몇 가지 사전 객체에 NIL을 설정하려고

전무 값을 삽입하는 시도. 오류 로그를 사용하여 코드에서이 위치를 찾을 수 없습니다.

사용중인 개체에 모든 인수를 올바르게 설정했는지 확인하십시오 (스택 추적에서 볼 수있는 매개 변수 중 일부). 일부에서 예외가 발생할 수 있습니다.

* 업데이트 :

5 ContactExplorer      0x00021990 -[PGFileTransfer createFileTransferError:AndSource:AndTarget:] + 153 
6 ContactExplorer      0x00020c0b -[PGFileTransfer upload:withDict:] + 717 
7 ContactExplorer      0x000157bf -[PhoneGapDelegate execute:] + 434 

내가 제안 할 수 있습니다이 오류가 PhoneGapDelegate에서 태어났다보다 : 나는이 선을 볼 때. 사전을 사용하는 PGFileTransfer를 사용합니다. 그런 다음 충돌합니다. 귀하가 제공 한 일부 데이터. 문제는 조기에 귀하의 주장을 실현시킬 수도 있습니다.

몇 줄의 코드가 도움이 될 수 있습니다. 특히 PhoneGap의 생성, 위임 및 사용자 정의 콜백.

+0

나는 이것이 확실하지 않다. 내 사전에는 사전 객체 나 그런 것이 없습니다. 이것은 매우 일반적인 오류이지만 키 값이 다릅니다 – user790514

+0

사전을 명시 적으로 사용하지 않으면 내 대답의 두 번째 부분을 참조하십시오. – SVGreg

+0

PhoneGap/SenchaTouch 앱에서 파일을 업로드하는 중에 이런 종류의 오류가 발생하지 않았기 때문에 사용중인 코드를 게시 할 수 있습니까? –