Closed iseeya-app closed 7 years ago
I guess this problem is caused by that Swift enums are not compatible with Objective-C, but you can try converting to make it work. I got this work in swift 2.2 (I have not installed xcode 8 for some reason), hope it can help you:
client.detect(...., returnFaceAttributes:[NSInteger(MPOFaceAttributeTypeAge.rawValue), NSInteger(MPOFaceAttributeTypeGender.rawValue), NSInteger(MPOFaceAttributeTypeHeadPose.rawValue) ] )
this solved the problem with same syntax for swift 3
thanks a lot cocof!!
Dave
Close as problem solved.
Hi,
I'm trying to use the library using swift 3 and ran into a issue while tying to use detect:
if I try and call the method like this:
client.detect(with: data, returnFaceId: true, returnFaceLandmarks: true, returnFaceAttributes: []) { (faces, error) in //...code... }
everything works fine and i get the faces array correctly.but when I try and add a face attribute type (instead of empty array as above), like this:
client.detect(with: data, returnFaceId: true, returnFaceLandmarks: true, returnFaceAttributes: [MPOFaceAttributeTypeAge, MPOFaceAttributeTypeHeadPose]) { (faces, error) in //...code... }
the program crashes with the following error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_SwiftValue isEqualToNumber:]: unrecognized selector sent to instance 0x1744502f0'
the error happens regardless of number and kind of MPOFaceAttributeType used any ideas ? perhaps some syntax issue I§m missing ?
Dave