generate a QR Code

  1. 5 years ago

    ginixsan

    9 Dec 2018 User since 2018
    Edited 5 years ago by ginixsan

    Is there any way to import a swift class or library? I want to generate a QR code from within the app and don't know how could I do it using Creo. I could generate it outside the app and then download it but I want to do it from inside the app. Found a library in C to generate QR Codes https://github.com/schoeggu/qrcode-generator
    but don't know how to include it since there is no info yet on the bridge API.

  2. marco

    9 Dec 2018 Administrator User since 2016

    @ginixsan plugin support will be added in Q1 of the next year.
    In the meantime you can use a service like http://goqr.me/api/ or http://goqr.me/api/doc/

  3. ginixsan

    10 Dec 2018 User since 2018

    Thank you @marco. Yes.. i did know that service.. but I didn't want to make a request cause I'm having problems with requests and they hang creo as you can see in the attached filter project just modified to point to a simple API

  4. marco

    10 Dec 2018 Administrator User since 2016
    Edited 5 years ago by marco

    @ginixsan your code hangs because there is a bug.
    (There was a bug also on our side that we already fixed).

    The first issue is that your query does not work, if you select Request (under HTTPClient1) and then press "Test Connection..." on the inspector you'll see that a {"code":301,"result":{"error":"bad_request"}} is returned. That means that there is some issue with the request you are sending.

    Then in the DidFinish event (of the Request object) you have an infinite loop with:

    for (var data in r) {
    
    }

    (We already fixed the infinite loop because this was an issue)

    My suggestion is to have the HTTPRequest fixed first, then activate the option "Report errors on NULL values) in the Advanced panel of the Creo preferences.

    Hope this helps.

  5. ginixsan

    10 Dec 2018 User since 2018
    Edited 5 years ago by ginixsan

    Thank you @marco .The HTTPRequest works.. as you can see in the attached screen capture (nevermind the 'bad_request' I just pasted that on to response myself)...the problem lies in the loop. I can make a count and returns a 1 count but when I try to iterate through it is when it fails...Any ideas?
    Btw, as soon as you release that major upgrade, you're going to have a great product. Congratulations.

  6. marco

    10 Dec 2018 Administrator User since 2016

    The issue (that we already fixed in our build) is in the way you loop inside a dictionary (a map).
    The correct way is to use the map.keys arrays, your code should be re-written as:

    // r.result is a map
    var result = r.result;
    
    // iterate through the keys array
    for (var k in result.keys()) {
        var value = result[k];
        Console.write("\(key) : \(value)");
    }
  7. ginixsan

    10 Dec 2018 User since 2018

    Thank you very much @marco for your advice. I'll give it a try.

or Sign Up to reply!