buildasaurs / XcodeServerSDK

Access Xcode Server API with native Swift objects.
MIT License
399 stars 30 forks source link

modelCode, modelName and modelUTI made optional in Device server entity #137

Closed MaxDesiatov closed 8 years ago

MaxDesiatov commented 8 years ago

This is a fix for https://github.com/czechboy0/Buildasaur/issues/283. As far as I understood, the Xcode Server instance had a few devices that were disconnected, but still in the list not having these properties, which was triggering JSON parsing issues.

voidrender commented 8 years ago

It looks like proxied devices can be missing a deviceType as well, so it will need the same treatment as the others. With that change, your PR works perfectly for me (at least in Buildasaur).

Here's a snippet from the getDevices call that shows my  Watch as missing the deviceType field:

{
        "_id" = dc092852df88fd1856281afea400598d;
        "_rev" = "646-2e7eb79be31cac5e72283aab895305bf";
        activeProxiedDevice =         {
            architecture = armv7k;
            connected = 1;
            deviceUDID = <redacted>;
            "doc_type" = device;
            enabledForDevelopment = 1;
            identifier = <redacted>;
            isServer = 0;
            modelCode = "Watch1,2";
            modelName = "Apple Watch 42mm";
            modelUTI = "com.apple.watch-42mm-1";
            name = "Isaac's Apple\U00a0Watch";
            osVersion = "2.2";
            platformIdentifier = "com.apple.platform.watchos";
            retina = 0;
            simulator = 0;
            supported = 1;
            tinyID = 941EB95;
            trusted = 1;
        };
czechboy0 commented 8 years ago

Thanks for taking a look @ioveracker, that sounds reasonable - @explicitcall could you please also make deviceType optional, like you did with the other properties? Then I'll be happy to merge, thanks! 👍

MaxDesiatov commented 8 years ago

@czechboy0 done. Cheers!

czechboy0 commented 8 years ago

Thanks @explicitcall!

valeriomazzeo commented 8 years ago

is it possible to release an hotfix?

czechboy0 commented 8 years ago

@valeriomazzeo It's already out: https://github.com/czechboy0/XcodeServerSDK/releases/tag/v0.7.0

valeriomazzeo commented 8 years ago

I am sorry, I meant an hotfix of buildasaur using this new version of xcodeserversdk

czechboy0 commented 8 years ago

Sure, let's sync up on Slack. Can I invite you? What's your email address?

czechboy0 commented 8 years ago

Invited. Feel free to delete the email above.