Xcode 7.3.1 The data couldn’t be read because it isn’t in the correct format.

Justin Howlett's Avatar

Justin Howlett

09 May, 2016 05:07 AM

I'm using Xcode 7.3.1 and Reveal 1.6.3 and I'm using the LLDB connection method (http://blog.ittybittyapps.com/blog/2013/11/07/integrating-reveal-wi...) instead of integrating the Framework.

I frequently get the following error: "The data couldn’t be read because it isn’t in the correct format.".

I did not get this issue in Xcode 7.3. Restarting Xcode, the simulator and Reveal seems to temporarily solve the issue.

  1. Support Staff 1 Posted by Tony Arnold on 09 May, 2016 05:14 AM

    Tony Arnold's Avatar

    Hi Justin,

    The next time this happens, could I ask you to grab a dump of the JSON data that Reveal thinks is invalid? You can do this like so (apologies, this is lengthy!):

    Reveal publishes itself as a Bonjour service from within your iOS app using the service type _reveal._tcp. You can use the dns-sd tool on your Mac to list any apps currently running the Reveal framework.

    To do so, open Terminal and issue the following command:

    dns-sd -B _reveal._tcp local
    

    You should see output similar to this:

    Browsing for _reveal._tcp.local
    DATE: ---Tue 07 Oct 2014---
    10:42:34.746  ...STARTING...
    Timestamp     A/R    Flags  if Domain               Service Type         Instance Name
    10:42:34.746  Add        3   4 local.               _reveal._tcp.        Reveal--bcea6fb9
    

    Note: dns-sd doesn't exit immediately. If it doesn't print out much output it might look like it has just locked up. It has not: you need to type Control-C to quit. This is also true of the other dns-sd commands listed below.

    You can see in the example above that there is one app being advertised with the instance name Reveal--bcea6fb9. The code at the end of the Instance Name is used to make each Reveal app on your network be unique. Your app's Instance Name name will be different.

    Press Control-C to stop browsing for services with dns-sd.

    Now we need to find out what port your app is listening on for Reveal connections. You can do this using the following command:

    dns-sd -L Reveal--93cf9fec _reveal._tcp.
    

    You will need to substitute your own app's Instance Name (which you got from the previous command) when using this command.

    Here is the expected output from dns-sd:

    Lookup Reveal--bcea6fb9._reveal._tcp..local
    DATE: ---Tue 07 Oct 2014---
    10:47:29.923  ...STARTING...
    10:47:29.924  Reveal--bcea6fb9._reveal._tcp.local. can be reached at localhost.:51441 (interface 0) Flags: 2
     devName=iPhone\ Simulator devSysVer=7.1 appName=RevealSample devSysName=iPhone\ OS isSim=true devLocalModel=iPhone\ Simulator appBundleId=com.ittybittyapps.RevealSample protoVer=14
    

    Type Control-C to stop dns-sd.

    In the example above you will see that the app is listening for connections on port 51441 and host localhost. The Reveal framework randomly picks a port number so it will be different each time you run your app. When run in the iOS Simulator the Reveal framework always binds to localhost (127.0.0.1). When run on an actual iOS device it will bind to the public network interfaces on that device.

    The host may also be listed as an IP address rather than as a hostname.

    Note: The dns-sd commands above should not give you errors and should not need to be run as 'root' (or via sudo). If you are getting errors, there may be something wrong with your network setup: Bonjour may be blocked, or the Bonjour daemon (discoveryd on OS 10.10 and later, mDNSResponder on earlier OS X releases) is not running correctly. Try rebooting your Mac if discoveryd or mDNSResponder are not running.

    Once you have the address and port of the Reveal service on your device, you should be able to use curl to retrieve the JSON data (replace the address and port with the information you collected above):

    curl -s -D - http://localhost:51441/application
    

    I'm sorry for the lengthy instructions — the information you provide should help me to work out what's going wrong here. Let me know if you would like more info on any of the above.

    thanks,

    Tony

  2. 2 Posted by Justin Howlett on 09 May, 2016 05:49 AM

    Justin Howlett's Avatar

    I've attached the curl output at the moment I received the "The data couldn’t be read because it isn’t in the correct format." error.

  3. Support Staff 3 Posted by Tony Arnold on 09 May, 2016 06:42 AM

    Tony Arnold's Avatar

    Hi Justin,

    I've seen this before. I've narrowed the problem down to an MASLayoutConstraint with a constant property that's coming through as 2.225073858507201e-308.

    In the past, this has been caused by setting the constant to something like CGFloat.min/CGFLOAT_MIN instead of 0.

    Would you mind checking for any instances where you do this in your project?

    thanks,

    Tony

  4. 4 Posted by Justin Howlett on 10 May, 2016 05:12 AM

    Justin Howlett's Avatar

    Hey Tony, I've found one instance of CGFloat.min and changed it to 0. That seems to have resolved the issue. Thanks for your help.

  5. Support Staff 5 Posted by Tony Arnold on 10 May, 2016 06:52 AM

    Tony Arnold's Avatar

    Thanks for letting me know, Justin. We'll look at getting a fix for this issue into a future update.

    -Tony

  6. Tony Arnold closed this discussion on 10 May, 2016 06:52 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac