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

Peripheral Cache call has Crash - "Attempt to insert non-property list object" #44

Closed
jotkailay opened this issue May 15, 2017 · 3 comments
Assignees
Labels

Comments

@jotkailay
Copy link

Using Bluejay SyncPeripheral call writeAndListen, which internally uses Bluejay Peripheral call cache(listeningCharacteristic: CharacteristicIdentifier)

crashes here :

UserDefaults.standard.set([bluejay.uuid.uuidString : newListenCache], forKey: Constant.listenCaches)

writing (example) :

[EAD75440-FEFC-4BCC-81CC-0328EABE2714 : [(serviceUUID: "036C0020-98BA-F401-F139-B510D0C303AD", characteristicUUID: "036C0022-98BA-F401-F139-B510D0C303AD")]

forKey

com.steamclock.bluejay.listenCaches

Consistent crash is Attempt to insert non-property list object

'Attempt to insert non-property list object {
    "EAD75440-FEFC-4BCC-81CC-0328EABE2714" =     (
        "(serviceUUID: \"036C0020-98BA-F401-F139-B510D0C303AD\", characteristicUUID: \"036C0022-98BA-F401-F139-B510D0C303AD\")"
    );
} for key com.steamclock.bluejay.listenCaches'

writeAndListen call :

writeAndListen(
                    writeTo:    OrthopulseBLEConst.SetUp.currentTime,
                    value:      UInt64(28),
                    listenTo:   OrthopulseBLEConst.Log.logEntry,
                    timeoutInSeconds : 20,
                    completion: {...}
   )

OrthopulseBLEConst.SetUp.currentTime is 
currentTime = CharacteristicIdentifier(uuid: "036C0015-98BA-F401-F139-B510D0C303AD", service: OrthopulseBLEConst.setUp)

logEntry is 
logEntry = CharacteristicIdentifier(uuid: "036C0022-98BA-F401-F139-B510D0C303AD", service: OrthopulseBLEConst.log)
@sakuraehikaru
Copy link
Member

Should be fixed in the latest master.

@jotkailay
Copy link
Author

Still get same issue on first run. Start from fresh with app deleted. Install, do initial pair, then sync.

At this point Constant.listenCaches is nil. So in Peripheral it enters the guard

guard let listenCaches = UserDefaults.standard.dictionary(forKey: Constant.listenCaches)

then it tries to do the same thing as before

            var newListenCache = ListenCache()
            newListenCache.append((serviceUUID: serviceUUID, characteristicUUID: characteristicUUID))
            
            UserDefaults.standard.set([bluejay.uuid.uuidString : newListenCache], forKey: Constant.listenCaches)
            UserDefaults.standard.synchronize()

I think it might be because its writing a mutable dictionary to UserDefaults, which isn't allowed. Not sure though.

@sakuraehikaru
Copy link
Member

Fixed together in person!

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

No branches or pull requests

2 participants