NativeScript / sample-ImageUpload

An integration of nativescript-image-picker and nativescript-background-http
Apache License 2.0
22 stars 19 forks source link

[iOS] Crash on upload #2

Open roblav96 opened 8 years ago

roblav96 commented 8 years ago

Terminal

git clone https://github.com/NativeScript/sample-ImageUpload
cd sample-ImageUpload
tns install
tns run ios

Error

NativeScript loaded bundle file:///System/Library/Frameworks/Photos.framework
NativeScript loaded bundle file:///System/Library/Frameworks/CoreLocation.framework
CONSOLE LOG file:///app/tns_modules/globals/globals.js:105:20: Border is deprecated
1   0x25495 NativeScript::microtaskRunLoopSourcePerformWork(void*)
2   0x2164f9e7 <redacted>
3   0x2164f5d7 <redacted>
4   0x2164d93f <redacted>
5   0x2159c1c9 CFRunLoopRunSpecific
6   0x2159bfbd CFRunLoopRunInMode
7   0x22bb8af9 GSEventRunModal
8   0x25cd5435 UIApplicationMain
9   0x44102c ffi_call_SYSV
10  0x43d873 ffi_call
11  0x20a0b NativeScript::FFICall::call(JSC::ExecState*)
12  0x273ff1 JSC::LLInt::setUpCall(JSC::ExecState*, JSC::Instruction*, JSC::CodeSpecializationKind, JSC::JSValue, JSC::LLIntCallLinkInfo*)
13  0x271c39 llint_slow_path_call
14  0x2798ad llint_entry
15  0x2798b9 llint_entry
16  0x2746e1 vmEntryToJavaScript
17  0x234399 JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*)
18  0x21cdd3 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&)
19  0x31b547 JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&, WTF::NakedPtr<JSC::Exception>&)
20  0x2da87 NativeScript::GlobalObject::moduleLoaderEvaluate(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSValue, JSC::JSValue)
21  0x3dbbb9 JSC::ModuleLoaderObject::evaluate(JSC::ExecState*, JSC::JSValue, JSC::JSValue)
22  0x3da9ad JSC::moduleLoaderObjectEvaluate(JSC::ExecState*)
23  0x279f3f llint_entry
24  0x2798b9 llint_entry
25  0x2798b9 llint_entry
26  0x2798b9 llint_entry
roblav96@Roberts-iMac:/Volumes/OSX HD/Downloads/sample-ImageUpload-master$
NickIliev commented 8 years ago

Hey @roblav96

We have just released NativeScript 2.3 - can you check if you still reproduce this error at your side after the update.

elliottohara commented 8 years ago

just upgraded to 2.3 and get this

ONSOLE LOG file:///app/tns_modules/globals/globals.js:119:20: Border is deprecated 2016-09-25 19:40:46.595 sampleImageUpload[824:302530] * JavaScript call stack: ( 0 uploadTaskWithRequestFromFile@[native code] 1 uploadFile@file:///app/tns_modules/nativescript-background-http/background-http.js:102:60 2 sendImages@file:///app/main-page.js:76:34 3 @file:///app/main-page.js:106:49 4 forEach@:1:11 5 @file:///app/main-page.js:105:21 6 promiseReactionJob@:1:11 7 UIApplicationMain@[native code] 8 start@file:///app/tns_modules/application/application.js:233:26 9 anonymous@file:///app/app.js:2:18 10 evaluate@[native code] 11 moduleEvaluation@:1:11 12 @:8:48 13 promiseReactionJob@:1:11 ) 2016-09-25 19:40:46.595 sampleImageUpload[824:302530] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot read file at file:///var/mobile/Media/DCIM/101APPLE/IMG_1911.JPG' *\ First throw call stack: (0x1831e2db0 0x182847f80 0x1838464c0 0x183847338 0x1838471ec 0x1838466ec 0x182c2d47c 0x182c38728 0x18384664c 0x18384714c 0x100874044 0x100872a28 0x100872540 0x10036067c 0x10064fde8 0x100656368 0x100656378 0x100656378 0x100656378 0x100656378 0x100656378 0x1006506c8 0x1005fceb0 0x1005e284c 0x1007769bc 0x100368cc0 0x100367d54 0x18319909c 0x183198b30 0x183196830 0x1830c0c50 0x1849a8088 0x1883ae088 0x100874044 0x100872a28 0x100872540 0x10036067c 0x10064fde8 0x100656368 0x100656378 0x1006506c8 0x1005fceb0 0x1005e284c 0x10070d93c 0x10037181c 0x1007f944c 0x100656c64 0x100656378 0x100656378 0x100656378 0x1006506c8 0x1005fceb0 0x1005e284c 0x1007769bc 0x100368cc0 0x1003a13f8 0x100009434 0x182c5e8b8) libc++abi.dylib: terminating with uncaught exception of type NSException ^C%

xerotolerant commented 8 years ago

Hey, I'm experiencing the same family of problems. The error above is basically saying that the application is unable to access the image in that folder. Apperently iOS does not pemit application to use files from outside their folder. Unfortunately I am yet to find a solution. I've been trying to reproduce This solution in nativescript but I haven't quite gotten it yet.

elliottohara commented 8 years ago

I resolved this personally.

The image picker's selected object has a getImage function that returns a Promise with an ImageSource... ImageSource has a saveToFile method.

Here's what I did. https://github.com/Mofusion/sample-ImageUpload

xerotolerant commented 8 years ago

Thanks a lot sir. That is exactly what I needed. I wonder why they didn't use that in the official one?