How to know why my media is crashing on the Chromecast? - ios

I'm implementing the Chromecast feature on an app of mine but I've been having a hard time figuring out a solution to my problem:
One specific stream doesn't get started on Chromecast, even though it works fine on iOS's default media player. I've tried using the debug string on mychromecastip:9222 but had no success.
I also checked the mim type, but it seems to be the same as my other working streams.
Any ideas on how to attack this problem?

You need to explain what you mean by "tried that and had no success". In the most recent build, you are required to run your own app first and then try to attach the debugger to port 9222; if you do it before connecting your app, it will not work. In addition, make sure you have turned on logging (see the Debugging section here) for details.

Related

Redirect console prints from Xcode

While developping an app for an iPad on my Mac, I use print logs to monitor what is going on (regular prints in Swift code). However I really don't like the Xcode console, and I'd like to be able to redirect the stream to a file, where I can then read it with a better log viewer (and add color!).
I'm executing the app in debug mode through Wifi on my iPad, but I want the logs on my Mac, so storing the logs to a file on the device is not really interesting (SO question here). Wrapping the debugger executable seems interesting, as suggested here but I couldn't find anything more recent (with lldb).
Alternatively, I could also run the debugger from the console and handler the redirection from there, but I don't know how to do that for debugging on a remote device over WiFi.
Any help would be greatly appreciated!

How do you access the all of the NSLog statements?

I have an application which is producing an error very intermittently, I am trying to run it down with an NSLog statement in swift. However, after I have noticed the bug has occured, when I hook up my iPhone to review the logs in the Devices window. I only see about 5 minutes worth of statements from various applications. Is there a way to get the history past what automatically comes up? Is there a way to get your applications NSLog statements only?
I haven't tried it from Swift, but we sometimes use NSLogger from Obj-C. It will log to a local Mac application instead of the console on the device. Alternatively, we sometimes log to a file and then transfer the file via email.
You can take a look at Bugfender, it's a product we have built to solve this problem. We had the same problem, especially when delivering beta apps to our customers, so we decided to make a product to solve this problem.
With Bugfender you will be able to get the device logs without any need to connect the device to your computer.
It's easy to integrate and you can choose which devices you want to get the logs from. Our service works offline and online, we have spent a lot of time to make it reliable and easy to use.

tvOS Difference Between TestFlight Installed App and Direct USB Run App on AppleTV Hardware

I am working to add a TopShelf implementation to my tvOS app. I am also working to create a Collection View implementation that has a similar functionality from within the app. Both work fine in the simulator on my Mac but don't work when deploying to my Apple TV using TestFlight. I tried using the USB-C cable to try to capture some logs or see what is going on when the UIActivityIndicator just spins. I thought it could be related to trying to download too many images or some other networking issue. I started caching the images and again that works well in the simulator but not on the device.
When I plugged into the device and ran the app it worked as it should, even with a higher number of downloads. I later updated the version via TestFlight and was back at the same position. Right now I am in a position where the app works every time with my own view controller and the TopShelf part, but does not work at all if deployed via TestFlight. I can't get any logs to figure out what is going on because when I connect the USB cable and run the app, it starts working.
Has anyone seen similar behavior or know of any way to troubleshoot what is going on?
I was able to determine there were a couple of things going on. The first was that the simulator was setup for a build configuration of debug. I went in to Edit Scheme and changed the Build Configuration for Run to "Release." This allowed me to recreate on the simulator what I was seeing on the device. It also made it a lot easier to debug as I could easily add logs to track down where the code was hanging.
The root of the problem was that I had a while loop doing nothing while I waited for a network block to update a flag. I've used this hack in other situations and have never run into a problem. If I added one NSLog command to the while loop it would flow through fine, but with nothing in the loop it just hung even though the network dispatch was done downloading data.
To fix this, I read up on using
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER)
which solved my problem (and I'm assuming made my code a lot more reliable too).

How to launch my app on connecting to USB?

I want to enable my app to launch when the USB connects. I imagine there are two approaches to this, the first having some sort of external monitoring process which is always running and checking for such an event, the second would be a process within the app itself.
Having spent the whole day on Google, I first thought I could use the ExternalAccessory.framework to monitor the USB port. However, the only examples I've seen is when the app is already running. Is there any process I can use that will allow me to add my app for launching when the iOS starts syncing?
Alternatively, is it possible to use ExternalAccessory for this purpose and I'm just going about it the wrong way?
Looking at the comments above, the comments by cmyr are indeed correct and as correctly pointed out by Larme, the only solution is to use MFi which can configure the USB device as a custom setting which will always prompt the iOS as a connection.

Debugging - Capture The State Of An iOS App

My app has a bug, which I am unable to replicate when it is run when plugged into the computer.
I see it three times a day and it is quite annoying.
Is there any way to capture the state of the app (when not connected to the computer) and see what's going on? Kind of like what XCode does when you use a breakpoint, but somehow send the data to it (or some order tool that I am unaware of) wirelessly.
UPDATE:
The app does not crash. It's just that certain UITableViewCells don't work as they should at certain times.
Try using Crashlytics its awesome for crashes. You should also use TestFlight which will give you live sessions/logs of your app. These both combined will tell you many things.

Resources