Pilloxa / react-native-nordic-dfu

Nordic Device Firmware Update for React Native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error on startDfu process: Exception '*** -[_NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'

ezranbayantemur opened this issue · comments

I did every step on installation process but stil getting error while starting DFU.

My code is:

         ...
         ...
            let
                formatFile = await DocumentPicker.pick({ type: DocumentPicker.types.zip }).catch(err => { throw "ERR_100" }),
                await BleManager.start()
                await NordicDFU.startDFU({ deviceAddress: "DC:5E:D4:87:DE:16", filePath: formatFile.uri }).catch(err => { throw err })
         ...
         ...

I don't know why and how this error happens.

Screenshot:
IMG_1260

package.json

    "react": "16.11.0",
    "react-native": "0.62.2",
    "react-native-ble-manager": "^7.2.0",
    "react-native-ble-plx": "^2.0.0",
    "react-native-camera": "^3.26.0",
    "react-native-document-picker": "^3.4.0",
    "react-native-fs": "^2.16.6",
    "react-native-modal": "^11.5.6",
    "react-native-nordic-dfu": "^3.1.0"

@Looveh Do you have any idea?

It looks like an issue about filePath value. If you give any invalid route it throws same error.

It was a problem about selecting the file. On iOS side if user will select a format file, file type should be public.archive. I was using DocumentPicker.types.zip

So changing this line

let formatFile = await DocumentPicker.pick({ type: DocumentPicker.types.zip }).catch(err => { throw "ERR_100" })

to

let formatFile = await DocumentPicker.pick({ type: 'public.archive' }).catch(err => { throw "ERR_100" })

solved my problem.