iOS 8 beta 5 Today view extension (widget) stuck at Waiting to Attach - objective-c

I want to debug a today view extension (widget) in iOS 8, so I select the widget under "Scheme" in Xcode, and select my iPhone as the device and hit run. It says "running today-view on iPhone" and on the side bar on the left it says "Waiting to attach". It gets tuck at the "waiting to attach" phase forever and never shows me any debugging info on my iPhone. However this works fine if I select the simulator as my device. After a few seconds of "waiting to attach" in the simulator, the widget comes alive and debugging info is displayed.
Has anybody come across why an extension won't show debugging info on an iPhone but will in the simulator?

Do not stop & start the debugger while notification windows is open in the simulator. Close the notification window. Stop the debugger. Start it again. Debugging widget in iOS8 is very delicate. You need to do everything in a slow non-agressive way (for now).

Edit the extension scheme and make sure that under Run, the Executable option is set to Ask on Launch.
Run the extension scheme.
From the list, select the Today executable.
It should launch the Today app and your extension should be attached to the debugger now.

Close the notification window. It should start working.

I've been able to debug my Today view extensions in this way.
1) Make sure the notification center is dismissed.
2) Stop every process in Xcode with the stop button.
3) Run the extension scheme
4) Pull down the notification center and should hear the usual "app launched" sound from Xcode
5) Debugger will be attached automatically and you'll be able to debug the extension.
Let me know if this works for you.

This happened to me .... Looks like you were doing everything right .... try all the above.
The problem went away when I unplugged and re-plugged in my Phone.

Sometimes click on the widget will fire the running of extension.

Delete the app from your phone
Run the today widget scheme
It worked for me.

Related

Xcode 6.1 crashing when running the project

I searched StackOverflow and it doesn't look like many people are having this problem, but for me, this happens very, very frequently. Maybe not every time, but perhaps every other time.
Once I try to build and run the app, Xcode crashes, and in a strange way: it just disappears with no error messages, no suggestion to report the problem, nothing at all. This happened with Xcode 6.0 as well. It doesn't matter whether I am running the app on a device or on an emulator.
To prevent the crash, I need to Product > Clean. If I do this clean each time before running the app, crashes do not happen, but once I forget to do that, Xcode can crash any moment.
I don't think I ever had this crash with an old project, but it keeps happening with the project that I started in Xcode 6.0.
Because of that, iOS development is becoming for me quite a painful exercise, similar to pre-Android-Studio Android development.
Is it just my problem, or maybe someone else is having it? Maybe someone has a solution?
I just started running into the same issue and found a workaround for it. Found it to be an issue with building when Xcode is full screen. Seems silly, but so far exiting full screen mode has worked for me. I've been able to re-introduce the issue after building full screen a few times, and then instantly fix it again by exiting full screen.
Yeah, it's not that the app is crashing, it's just that the click is triggering the red close window button behind the red button (yeah, seriously). You'll notice, Xcode is still open, it's just that the window has closed. You might also notice that sometimes when you click "stop" in full screen mode, it switches to non full screen. Again, the tap is passing through the run/stop buttons to the underlying window controls.
So dumb.
I solved it using 'cmd + R' instead of clicking the run button

changed product name in build settings, now app won't launch in simulator

I wanted a different title to be displayed in the sub-title under my iPad app's icon and changed the Product Name for my app under Build Settings.
This worked but has had a strange side effect. Whilst the app continued to work perfectly on a connected iPad, on the emulator it now behaves in a similar way to that described in [this question].1
Namely, it says it has finished running <my app> on iPad 6.0 Simulator
I tried changing the Product Name back but the problem persists.
I also tried some of the suggestions on the other question (e.g. removing armv7 frfom Required Device Capabilities) but nothing worked.
This isn't a showstopper at the moment as I have a real iPad to test on but I'd still like to understand what is going on, if anyone knows.
Sounds like time for a reboot of the Mac. Restarting Xcode might suffice. One other thing to try is to delete the app from the simulator.
I have seen this on iPhone simulator 6. Many a times, when you click "Run" again - it runs without problem.
However if that doesn't work, you may try one of the following:
Project->Command+Alt+Shift+K - a choice will appear saying something like clean folders. Do it.
In organizer, go to derived data folder (finder) using tiny arrow just at the right of your project. Try deleting your project from finder. If it doesnt delete at once, try it often.
Try resetting iPhone or iPad simulator.
Exit XCode and reopen project. Do the same with iPhone / iPad simulator.
If you are wondering why this is happening, no one really knows! It's just some flags gone bad, restored once you re-do everything for it to work, that's it.
Have you tried switching off the Debugger?
So Edit Schemes -> Debugger -> None
Also restarting the Simulator and Xcode and cleaning the project may help
Use another way: click on the azure icon of your project, keep the trackpad pressed until you see it allows to edit the name. Choose the name that you want, then a sheet like this will appear:
Click "rename" and you're done with it.

How can I simulate my Metro app being terminated?

VS2012's default C# "Metro style" project templates include code in App.xaml.cs (in the OnLaunched override) to restore the application state after a suspend-and-terminate. This code only runs when LaunchActivatedEventArgs.PreviousExecutionState is Terminated, i.e., "The app was terminated after being suspended."
How can I force my app to be suspended and terminated, so I can test this suspend/resume functionality in my app?
Things I've tried that don't work:
If I use the "close app" gesture (drag from the top of the screen to the bottom), then the next run's PreviousExecutionState is ClosedByUser.
If I kill the app -- either using Task Manager, or (if I was debugging) with the "stop" button on the VS toolbar -- then the next run's PreviousExecutionState is NotRunning. This is true even if Task Manager showed the app as "Suspended" before I ended task, so clearly it's more nuanced than the description of "terminated after being suspended".
You'd think I could just switch away from my app, and then open lots of other Metro-style apps until my app eventually gets kicked out. But even if I open every single Metro-style app that ships with the Windows 8 Release Preview, that's apparently not enough memory pressure to make Windows terminate my app. (I assume Windows would be less likely to terminate an app that was being debugged, so I launched my app from the Start screen -- no debugger -- before I tried this.)
It does appear that, if I switch away from my app and type into a StackOverflow window for several minutes, that my app will eventually get terminated, so perhaps there's a time-based component to it. But if I have to wait five or ten minutes every time for my app to terminate, that's a pretty slow testing cycle.
Given that this is something developers will have to test, you'd think there would be a nice, easy way for a dev to force an app to suspend-and-terminate. Is there some kind of stress-test app that comes with Visual Studio that will force enough memory pressure? Is there some menu item in Visual Studio that will force termination of my app? How are we supposed to test this?
In Visual Studio 2012, when you're debugging, there are "Suspend", "Resume" and "Suspend and Shutdown" buttons. By default, you should see the buttons while you are debugging your app. See this article for more info on debugging process lifecycle.
I had trouble finding the Suspend control because VS wasn't showing a second row of toolbars for me. As it turns out, this is on the "Debug Location" toolbar. Make sure you have this toolbar turned on and then you should be able to find the Suspend control (and it does work to solve the OP's problem).
If they don't show by default, go to TOOLS -> CUSTOMIZE, and under the Toolbars tab, check the box that says "Debug Location"
I was looking for VS 2013, just in case others came for the same reason.
Source:
http://blogs.msdn.com/b/visualstudio/archive/2012/08/23/new-visual-studio-2012-debugging-features-for-the-windows-8-app-lifecycle-model.aspx
a busy cat http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-92-metablogapi/2210.image_5F00_thumb_5F00_1FBA9C1E.png

Output of NSLog for applications running without XCode?

I'm distributing my first Mac OS X application to beta-testers and i have a silly question but have trouble finding the answer :
"Where is the output of NSLog calls once your application is packaged into a .app bundle ?"
Henry,
Asked and answered: Here
Basically, stdout/stderr go to the console log, visible with the Console.app.
There is not so elegant but quite user-friendly method. It is an Organizer. Yes, I know, it is a part of Xcode. You can blame me for the fact that my answer is supposed to reveal some xcodeless method but you can use the method described below even if you have no source code. It could be useful in some cases.
So, here is the method:
Open Xcode.
Select Window -> Organizer menu item.
Select your plugged iDevice there.
On your iDevice check that Settings -> Developer -> Logging switch control is on.
Launch the app.
In Organizer select Device Logs tab. There are all the logs of your device to the moment.
If there are no logs at Device Logs tab check #4, then reconnect the device. In some case you should then restart Xcode.

When calling to NSOpenPanel's runModal, my application will not properly terminate

I'm writing a simple Cocoa Application, no core data or multiple document support. Running on a Mac Pro, OS X 10.6.6, Xcode 3.2.3.
I have reduced my application to the following code in my AppDelegate class:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel runModal];
return;
}
From within the debugger, I will run my application. As expected a somewhat not-to-useful OpenPanel will appear. I will click Cancel and it will disappear. All this is as expected. When I click [Command + Q] to Quit the application, the UI will go away but the debugger will indicate that the application is still running (as does the console output).
Based upon all the information I'm reading, I should not have to do anything else in order for this to run right. I've downloaded several examples on the Open Panel's usage but most use the deprecated methods of opening modal giving additional information as parameters. FWIW, I tried those methods and am still seeing the same result.
One last item, when the Open dialog appears, just for an instant I see a message box asking me something to the extent if I want my application to receive incoming connections. The dialog quickly disappears. I don't know if that is part of my problem or not. [Update - this deals with my Firewall being turned on.]
Yes, I'm fairly new at Objective C but not at programming in general. Any words of wisdom is greatly appreciated!
2011.02.07 - Update:
I have walked the debugger line by line without incident. There is no indication of any program failure in the console window.
I say that the debugger is still active after [Command + Q] because the Stop Process toolbar button is still enabled as is the Break button. Further the console indicates that after I tell the application to terminate (either via the menu or key command) that it is still running. The following is the Complete console output from start of run to after I Quit the application.
Program loaded.
run
[Switching to process 62370]
Running...
The Activity Monitor (system tool) will show my application terminating (no longer shows up as a process) but the Debugger will still not transition to "edit" mode - if I tell Xcode to run the debugger again, it will ask me if it's OK to Stop the current debugging session. If I was in Windows I would start looking for background threads keeping the process alive but as far as I know, NSOpenPanel should not be doing something like that.
I have further simplified the program to nothing more than creating a brand new Cocoa application and inserting the code snippet above - no other additions to the template project or updates in any way.
And lastly, when the application is run under the Leaks Performance Tool, everything runs fine when the panel is created but never used. When created and actually used though, at the end of the run I will get the following message in the tool "insufficient task_for_pid privileges (leakagent64)". Googling this hurts. If I read it right, the debugger does not have sufficient permissions to fully kill the target process ??? Now that sounds stupid but ... It does not make sense!
Another update - I just downloaded and ran FunHouse, one of the SDK sample applications that also uses NSOpenPanel. Well don't I feel special. It exhibits the same exact behavior. So from this I conclude either Apple has a bug in their code, my machine is special and messed up, and finally, it is Not my code that is at fault. That being the best part. Tomorrow, I will use a friends Mac and see if the same behavior is exhibited on his box.
This is just too weird.
I rebooted my box, took it to work and found it worked like a charm! I will assume this is fixed and has nothing to do with any other connected devices at home as compared to at work.
If it re-exhibits at home, then it is a network/device issue. Thanks all for your inputs and suggestions! Very much appreciated.
What, specifically, does the debugger say? It's possible that your program crashed, so the debugger is showing you information about the crash.
What if you omit any attempt to run an Open panel?