Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare failing on IOS #43

Open
jackaryas opened this issue Aug 21, 2015 · 1 comment
Open

Prepare failing on IOS #43

jackaryas opened this issue Aug 21, 2015 · 1 comment

Comments

@jackaryas
Copy link

After having installed the plugin and carried out initial development on Android (Kitkat 4.4) and a Samsung Gs4 i decided to test it out on IOS and immediately ran into a problem.

I am testing IOS on a iPad Mini and IOS 8.4 but specifying lower versions as target in xCode seems to make no difference.

The prepare method fails every time with little to no debug information being logged to the console. After having done some digging it appears to be failing at the native code level namely on getDeviceAllData().

I do not know Objective C so diving into the code isn't really an option, have a basic grasp of Java however.

For reference the iPad is connecting to the BLE device but fails to prepare.

Is this a known bug? (i tried a few of the forks which did not help), i am wondering if it is an issue with a missing file on IOS or something as i had issues with installing and had to manually add files to compile sources and link binary with libraries in xCode.

Any help on this issue would be great, thanks

For reference here is my connect / prepare code

device.connect(function () {
                    if (!device.isPrepared) {
                        //$q.when(prepareDevice(device), prepareSuccess, prepareFail);
                        device.prepare(prepareSuccess, prepareFail);
                    }
                }, //Connection error
                        function (err, error) {
                            console.log(err, error);
                            console.log("connection failed");
                            connected.reject(device);
                        });
@jackaryas
Copy link
Author

In case anyone is having the same issue i have managed to get around it (i think) by manually prepping the device using the following (pretty ugly) function

    function manuallyPrepare(device) {
            device.discoverServices(prepChars);
            function prepChars() { // IOS hates anonymous callbacks apparently
                angular.forEach(device.services, function (service, i) {
                    if (service.uuid === tempServiceUUID) // store service index as different cross platform
                    {
                        tempServiceId = i;
                    }
                    device.services[i].discoverCharacteristics(); // discover characteristics for each service
                });
            }
            return device;
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant