question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[iOS] Immediate Crash

See original GitHub issue

My app crashes and I get this error when trying to upload a file on iOS 😢

Source

<ListView row="0" [items]="_images" (itemTap)="onItemTap($event)">
    <template let-item="item">
        <Image [imageSource]="item"></Image>
    </template>
</ListView>
import {Folder, FileSystemEntity, knownFolders, File, path} from "file-system"
import {ImageSource, fromFile, fromUrl} from "image-source"
import {ImageFormat} from "ui/enums"
import {Session, Task, session} from "nativescript-background-http"

onItemTap(args: ItemEventData) {

    let image: ImageSource = this._images[args.index]
    let folder: Folder = knownFolders.documents()

    let fileName: string = "IMAGE_FILE.png"
    global.tnsconsole.log('fileName', fileName) // IMAGE_FILE.png

    let filePath: string = path.join(folder.path, fileName)
    global.tnsconsole.log('filePath', filePath) // /var/mobile/Containers/Data/Application/EB845FC8-96DE-4FAB-95F8-93B78DB38724/Documents/IMAGE_FILE.png

    if (image.saveToFile(filePath, ImageFormat.png)) {

        let sesh: Session = session("image-upload")
        let options: any = {
            url: 'http://192.168.0.2:8083',
            method: 'POST',
            headers: {
                'Content-Type': 'application/octet-stream',
                'File-Name': fileName
            },
            description: '{ \'uploading\': ' + fileName + ' }'
        }
        let task: Task = sesh.uploadFile(filePath, options)

        task.on('progress', logEvent)
        task.on('error', logEvent)
        task.on('complete', logEvent)

    }

    function logEvent(e) {
        console.log(e.eventName)
    }
}

Error

CONSOLE LOG file:///app/dev/tns.console.js:107:22: 
[LOG] 06:09:32:993 itemTap_9_0
fileName > IMAGE_FILE.png

CONSOLE LOG file:///app/dev/tns.console.js:107:22: 
[LOG] 06:09:32:995 itemTap_9_0
filePath > /var/mobile/Containers/Data/Application/EB845FC8-96DE-4FAB-95F8-93B78DB38724/Documents/IMAGE_FILE.png

1   0x5a56d3 NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
2   0x987c15 ffi_closure_inner_SYSV
3   0x98b0b8 ffi_closure_SYSV
4   0x25e5dc23 <redacted>
5   0x25f1749d <redacted>
6   0x25f237af <redacted>
7   0x25c5f799 <redacted>
8   0x2164f2b1 <redacted>
9   0x2164d5a7 <redacted>
10  0x2164d9e5 <redacted>
11  0x2159c1c9 CFRunLoopRunSpecific
12  0x2159bfbd CFRunLoopRunInMode
13  0x22bb8af9 GSEventRunModal
14  0x25cd5435 UIApplicationMain
15  0x98b02c ffi_call_SYSV
16  0x987959 ffi_call
17  0x5774b7 NativeScript::FFICall::call(JSC::ExecState*)
18  0x7c50ab JSC::LLInt::setUpCall(JSC::ExecState*, JSC::Instruction*, JSC::CodeSpecializationKind, JSC::JSValue, JSC::LLIntCallLinkInfo*)
19  0x7c2e61 llint_slow_path_call
20  0x7cac7d llint_entry
roblav96@Roberts-iMac:/Volumes/OSX HD/Projects/sandbox/client$

package.json

"nativescript": {
    "id": "com.roblav96.sandbox",
    "tns-android": {
        "version": "2.2.0"
    },
    "tns-ios": {
        "version": "2.2.1"
    }
},
"dependencies": {
    "@angular/common": "2.0.0-rc.5",
    "@angular/compiler": "2.0.0-rc.5",
    "@angular/core": "2.0.0-rc.5",
    "@angular/forms": "0.3.0",
    "@angular/http": "2.0.0-rc.5",
    "@angular/platform-browser": "2.0.0-rc.5",
    "@angular/platform-browser-dynamic": "2.0.0-rc.5",
    "@angular/platform-server": "2.0.0-rc.5",
    "@angular/router": "3.0.0-rc.1",
    "@ngrx/core": "1.0.2",
    "@ngrx/store": "^2.1.2",
    "ansicolors": "latest",
    "ansistyles": "latest",
    "lodash": "latest",
    "lokijs": "latest",
    "moment": "latest",
    "nativescript-angular": "0.4.0",
    "nativescript-background-http": "latest",
    "reflect-metadata": "0.1.3",
    "rxjs": "5.0.0-beta.6",
    "tns-core-modules": "2.2.1",
    "zone.js": "0.6.12"
},

Using the latest version with the example server.js backend supplied in this repository.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
karan1149commented, Sep 24, 2016

Also having this issue.

1reaction
roblav96commented, Oct 29, 2016

@NickIliev I can confirm that the latest version works flawless on android and ios 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

App crashing immediately on start up after upgrading to iOS12.
Running fine in simulator but crashes in device. No crash logs recorded. In line error shown after launching the app Thread 1: EXC_BAD_ACCESS...
Read more >
iPhone Apps Crashing on iOS 16? 5 Ways to Fix It! - YouTube
Apps are crashing on your iPhone ? Here's what to do. Free download for ReiBoot: https://bit.ly/3h63uSOChapters:0:00 Intro & Preview0:18 ...
Read more >
iOS immediate crash!!!! : r/MagicArena - Reddit
iOS immediate crash !!!! The app immediately crashes with no explanation. After SEVERAL reinstalls STILL THE SAME ERROR OCCURS! UNPLAYABLE!
Read more >
How to Fix Crashing Apps on an iPhone or Android?
10 Solutions to fix App Crashes and Keep Apps Running: For Apple iPhone, Samsung Galaxy, LG, Lenovo and Sony Xperia smartphones. If you've...
Read more >
9 Fixes for When Your iPhone Apps Keep Crashing
9 Fixes for When Your iPhone Apps Keep Crashing · 1. Check Your Internet Connection · 2. Close and Relaunch the App ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found