Why doesn't the Xcode Organizer Console show logs from my device? - xcode

When I plug my device in and run my app, the log output doesn't show up in the Organizer Console. Is there some other place to look for log output? I thought I could find it in Console.app but I'm having trouble.

It sounds like you're looking in xcode 'organiser' window, which is the correct place.
Are you running foul of this bug:
Why is XCode Organizer console sometimes empty when I connect my iPhone
Essentially you may need to completely quit and restart xcode after connecting the device and/or whenever it stops working.

I noticed in the Settings app, there is now a Developer entry which has a Logging On/Off switch. I'm not sure what it does exactly but you might want to try turning it on.

Related

Repeated request for microphone permission on iOS Simulator

I'm working with Xcode 10.1 (10B61) on an app that needs permission to use the microphone.
(Almost) Every time I start the app from Xcode (in simulator) I get a system popup:
"Appname" would like to access the microphone
"Privacy - Microphone Usage Description"">
It doesn't matter if I select "Don't Allow" or "OK". This message keeps popping up.
How can I fix it?
Update [fixed]
This issue seems to be fixed in Xcode 10.2 đź‘Ť
You can get rid of this following this steps:
Go to "Security & Privacy" Settings on macOS.
Select "Microphone" on the left panel.
Uncheck the Xcode option on the right panel.
Edit:
Unfortunately it looks like the following procedure is just a temporary fix. After some time the dialog started appearing again. Repeating the procedure fixes it for an additional period of time.
I had the same problem and what helped in my case was disabling and then re-enabling microphone permissions in the the Simulator.
Steps to fix:
go to Settings app in the Simulator
find your app settings page within the Settings app
disable microphone permission (or any other permission that is causing trouble)
re-enable microphone permissions
After this procedure, the microphone permissions dialog stopped appearing every time I would run the app.
Note that I did run the app with the permissions disabled and navigated to the point where permissions are required before re-enabling them (but I don't think that's required).
Hope this helps, it did in my case.
After looking for a workaround this one seems to fix it for me:
In Simulator go to Settings > Your App > Disable the Microphone Access
Update:
Not solving this issue but might be helpful:
You can dismiss the popup via Esc key - that should be way faster than clicking a button
Another work around is to check if the app is running in the simulator and disable the audio code:
struct Platform {
static var isSimulator: Bool {
return TARGET_OS_SIMULATOR != 0
}
}

How do I view console output on Apple Watch when not connected to the debugger?

So I'm trying to track down an issue that crops up when I'm NOT debugging with Xcode on the Apple watch, and I've discovered that the Apple Watch has some serious problems with console output if it wasn't launched via the debugger. Given the following code:
- (IBAction)onPrint:(id)sender
{
NSLog(#"############## Printing! ##################");
printf("************** Printf! ******************\n");
}
When launching via the debugger, it shows both lines in Xcode's console window. Great, no problems there.
If, however, I launch the watch app manually (from the watch itself), I get nothing in the console log via the devices window in Xcode, and nothing in the Console app on the mac (other than the normal "kernel[0] : prevent idle sleep list" messages the watch emits to the console from time to time).
I also tried connecting to the watch extension process using the Debug -> Attach to Process menu in Xcode, but it still won't print anything. Clear console, reload console... nothing works. I've looked all over SO for answers, and tried everything marked as an accepted answer or not, but nothing seems to work. This app is as simple as it can get: A single button that executes the code above to print to the console.
Is it just broken? Or is there some other arcane magic I must weave? I'm running Xcode 8.1 and WatchOS 3.1 on an Apple Watch 2.
It looks like this is just a limitation of WatchOS. The only way I've been able to get data back is by storing logs in a file and then fetching the file later.
Thing that can help you is called sysanalyse: you'll have to add special profile to both iPhone and Watch, and this will allow to see your app's logs in Console and via sysanalyse reports. Instructions and profiles are provided here.
If you are debugging background tasks, important to know: watchos's daemon will not terminate process what had already used it's background execution time limit if it is connected to debugger.
This is really odd because I was able to see log statements on the console. It's just now, I'm not. This is for Watch OS 6, xcode 11.2.1.

Xamarin Remote Simulator results in blank screen

I know this feature is very new, so I'm hoping someone has had experience with this issue before and may shed some light on what might be going on. Right now we are trying to utilize Xamarin 4.2's new "remote iOS simulator for Windows". When I build to Mac simulator, it works fine the app shows up and no issues. When I turn on the option to use the remote simulator, the simulator opens, and then there's just a blank screen, as you can see from the screenshot there's no errors and it built fine:
Looks like you are hitting the following:
https://bugzilla.xamarin.com/show_bug.cgi?id=42333
The remote simulator is in preview, so there are likely to be bugs that have not been fixed yet. I'd suggest adding a comment to that bug report with any information you can provide.
If you would like to receive a notification when the bug is updated, you can add yourself to the CC list for the bug. Please note that you will need to create an account on that system if you have not already done so.

XCode Organizer console doen't show logs from the device, even though I have restarted the Xcode

XCode Organizer console doen't show logs from the device, even though I have restarted the Xcode.
Is there other ways to get the device log except XCode Organizer console ?
I haven't gotten XCode to start showing logs (it has only shown one new log in the past 4 months). But to answer your second question, device logs are copied to ~/Library/Logs/CrashReporter/MobileDevice/ (on the computer, not on the device).

Can't run Instruments from Xcode

I recently upgraded to Snow Leopard and since then I am having difficulty running Instrument to instrument my app from Xcode. The Record button would be grayed out, and nothing happens. There is no message in Xcode's console telling me what's wrong either. I used to be able to attach it to process or launch the process from Instruments as well, all these are no longer working.
Any idea what's causing this?
I had the same issue! I could only use Instruments on my iPhone but not on iPad or iPad2!
Whenever I started instruments with Xcode 4 it would just beep and the record button would be disabled..
I solved this issue by in XCode going to >Targets>Edit Scheme>Profile "yourAppName" and changing the Build Configuration from Release to Debug.
Then try to profile again Product>Profile
If you get the beep again..
You will see that it says "CHOOSE TARGET" next to the record button open the drop down >Choose Target> "yourAppName" then hit record.
This solved it for me and was finally able to run instruments again!
I know this post is old but i hope it helps someone.
I had this issue in Xcode 7. It turned out that, somehow, in the Profile section of my scheme settings, the Executable field had been cleared:
I set the Executable field to my target name and the menu enabled again.
I was unable to get instruments to work with my iPhone (it had previously worked). The behaviour I saw was that xcode would say "finished running - Profiling [app name]" before the instruments window was even shown (the choose instrument window).
I worked around this by going to product->scheme->edit scheme, select profile [app name] and select an instrument (i.e. Allocations) under the instrument drop down (instead of "ask on launch").
Once I did this, selecting Product->profile worked for me and the instruments was running.
I wanted the zombie instrument which strangely isn't in the xcode dropdown, I was able to use this by simply using file->new in instruments (while the allocations instrument was still connected and running) and I could then choose the zombies instrument and the record button wasn't greyed out!
All of this was with iOS 7.0.3 and xcode 5.0.1.
I hope this helps at least one other person to stop ripping their hair out, but knowing xcode I somehow doubt it!
I had the same problem after reinstalling Snow Leopard last week. I moved my /Developer folder to /Developer_old and re-ran the Xcode installer pkg, and now have Instruments back.
HTH
The problem is instrument needs a gateway to your app and simply pointing to it doesn't do it. The Instrument's workflow is as such: You need to profile it from Xcode first.
I highly recommend seeing Apple's own links shared in this answer. They are amazingly good and simple.
Apple's documentation says
If Instruments has access to information about your app’s source code,
a leak is reported as a class name. Otherwise, a leak is reported as a
memory address, such as Malloc-size. To ensure that Instruments has
access to information about your code, initiate profiling from Xcode
(see Profile from Xcode) or configure a symbol mappings file (see Map
Data to Source Code).
what worked for me was
running the app on Simulator
going back to Xcode's Debug Navigator (CMD+7)
selecting CPU/Memory
clicking Profile in Instruments
Note that if you have multiple targets, it is very likely that you need indeed to tell Xcode which one you want to profile. Use the edit targets scheme above
I've noticed that if I go to File->Record options, and press OK, the record button suddenly is enabled.
Make sure all of your instruments support recording modes. When I upgraded from Xcode6 to Xcode7, one of my instruments was marked as "This instrument's supported recording modes are none". When I deleted this specific instrument, the recording button becomed enabled.
As pointed out in Apple's discussion forum, restarting your machine works. It works for me.

Resources