Search code examples
iosobjective-cmobileaffdex-sdk

Affdex iOS SDK "set the licensePath property with a valid file path" error


Using the iOS SDK, I tried to set the license token like this:

#ifndef YOUR_AFFDEX_LICENSE_STRING_GOES_HERE
#define YOUR_AFFDEX_LICENSE_STRING_GOES_HERE @"090b118356d7c6afc08b6b58763...snip...56ade05a27c71c80f221"
#endif

but when I tried to run your AffdexMe demo, it says

Detector Error. No license provided.

Solution

  • When setting the macro, you need to use the contents of the SDK license file that you received from Affectiva. When you inspect the license file's contents, you see a JSON string like this:

    {"token": "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "licensor": "Affectiva Inc.", "expires": "2019-04-15", "developerId": "[email protected]", "software": "Affdex SDK"}
    

    Set the macro accordingly:

    #define YOUR_AFFDEX_LICENSE_STRING_GOES_HERE {\"token\": \"1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\", \"licensor\": \"Affectiva Inc.\", \"expires\": \"2019-04-15\", \"developerId\": \"[email protected]\", \"software\": \"Affdex SDK\"}
    

    Note that it is important to escape each double quote character with the backslash character so that the C preprocessor doesn't get confused.