App launched from Xcode always starting behind all other apps? - xcode

A specific project I've been working on for a while now all of a sudden would display the application - when launched via 'Run' from Xcode 4 - behind all other running apps, in particular behind the Xcode IDE.
This happen regardless of the Debug Workflow setting. Changing it to Xcode always behind only causes Xcode to be hidden behind the other running apps as well. Very weird.
I couldn't find a scheme setting changing the app's behaviour, deleting all from the build folder had no effect either. Launching the app directly via Finder works just fine and brings it to the front.
Edit #1:
Deleting the app's prefs, user and system caches, the general clean using Onyx didn't help at all -
of all apps this particular one keeps launching behind all other running apps.
Clueless.

Related

Xcode 7.3 wont attach to simulator to debug

So I upgraded to Xcode 7.3.1 and now my Xcode will build, and deploy my apps (yes every app, even a brand new blank one) to the simulator but the app never launches on the simulator and the debugger never attaches, Xcode just hangs and has to be force quit. I've completely wiped out Xcode and all simulators and re-installed to no avail. I've scoured Stack Overflow and Google trying every piece of advice and still no luck. Anyone anywhere have any idea how to solve this issue? If I downgrade to 7.2.1 I'm able to debug in the simulator just fine.
Let me know if you need more information.
My Apps run just fine on the simulator, and if I try to attach the debugger to a running app it wont and Xcode hangs in the attempt, when attempting to attach this way at least Xcode doesn't have to be force quit.
FYI, I can debug on a device this is only a simulator issue.
I had this same issue, and tried fixing my projects and reinstalled Xcode twice before I was able to get Simulator to crash and give me an error report that called out Cylance. Luckily I have access to administer our Cylance portal, so I was able to work through the issue to narrow down the problem.
Symptoms:
When running an app from Xcode, the Simulator launches but the application does not launch within the Simulator
Trying to stop the application from within Xcode does not work, and generates no messages
Trying to re-run the application from within Xcode generates the following message: ‘An instance of “APPLICATION NAME” is already running. Choose “Stop” to terminate and launch a new instance.’ But pressing Stop does nothing.
Xcode will not quit, and eventually the user must Force Quit to exit Xcode
Within the OS X console, the following messages are displayed:
6/3/16 7:35:38.000 PM kernel[0]: AMFI: com.apple.dt.ins(pid 2239) - [deny-mmap] main process is a platform binary, but mapped executable file is not: /Library/Application Support/Cylance/Desktop/CyMemDef.dylib
6/3/16 7:35:38.000 PM kernel[0]: AMFI: com.apple.dt.ins(pid 2239) - [deny-mmap] mapped file has team identifier XXXX: /Library/Application Support/Cylance/Desktop/CyMemDef.dylib
Resolution:
The problem is caused by Memory Protection being turned on within the policy assigned to the Mac within the Cylance portal.
To resolve the issue, place the Mac into a zone/policy that does not have Memory Protection turned on. Auto Quarantine and Protection Settings can be left on.
During my testing, I was not able to come up with a list of exclusions that allowed me to leave Memory Protection on, so I ended up disabling it completely.

Why does my exported Cocoa Mac application crash (or not even open) upon launch?

Using Xcode Version 7.2 on my OS X 10.10.5.
I have a Cocoa application written in Objective-C that utilizes Google's CorePlot library. When I run the app (Product --> Run), it runs perfectly fine.
However, when I archive the project (Product --> Archive --> Export --> Export as a Mac Application), and then run the created '.app' by double-clicking it, the app crashes right away without even loading.
There's no reason for it to crash; the archive was done successfully, and the first window/ViewController don't try to access saved variables that would not be present on a first run.
Basically, double-clicking the app doesn't even open the app icon in the dock or show a window being created - it's like the app won't even open.
This same crash/no loading happens when I try to open/install the app using any of the options under "Export"
It turns out this issue can occur if your app has trouble importing or finding certain classes/files.
In my case, for some reason, when I opened my project and ran the app, it would find CorePlot's CorePlot.h file. However, when I archived the app and exported it to be used on other people's computers, it would not archive and export 'CorePlot.h'.
As a result, my app would crash right away as it could not find 'CorePlot.h'.

iOS9 Share Extension can not debug on Xcode

When I build share extension from Xcode for the real device, Xcode arbitrarily stop debug. But when I launch for simulator, the problem does not occur.
Environment
Xcode 7.1.1
iOS 9.1
Details
When I build share extension, Xcode shows "Finished running MobileSafari.app on iPhone", but Safari does not run. And, The square stop button is arbitrarily gray. So, I launch Safari by myself and choose my extension and post. The debug section does not show anything. Also, URL request is not sent Rails server.
This is the picture when I build the share extension for the real device.
I do not know why the real device can not launch share extension at Xcode.
If anyone know the answer about this problem, please tell me.
Typically you can debug a share extension by going to Debug -> Attach to process or PID and entering the name of your share extension. From there you can open the share extension on your device or simulator and Xcode's debugger should attach and hit breakpoints correctly. However, I've noticed that log messages do not show up when doing this, nor do values populate for variables in the debugger view.
Here's how I got the debugging to work correctly. Run the share extension scheme. When it asks you what app to run, chose 'Photos' (because that's the app your extension will operate in). The Photos app will then launch on your device and you may proceed to use your extension. The debugger in Xcode should then work as expected.
I encountered this issue as well, though unfortunately I don't know the exact solution, maybe I can offer some information that might be helpful.
I (like you, judging by your screenshot) was using Cocoapods, and Cocoapods was copying resources from the pods into the bundle of the app extension after it was code signed. If memory serves, this was interfering with the code signing in some way, and therefore preventing the app from running under the debugger.
I believe that one of the symptoms of this was that logs appeared in the mac's console (or the device's console, can't remember which) saying something about "blasting onto the device using the old skool[sic] method."
You could confirm that this is the case by removing Cocoapods from your project, or any pods that require resources to be copied after compilation. I believe that the solution was to add some kind of special build phase to the extension project to copy the bundle resources, and disabling whatever Cocoapods uses by default.
As a temporary solution, I believe that deleting your app from the device should allow you to attach the debugger once, on the run where the app is installed for the first time. You might also try deleting derived data for your project.

XcodeServer only one simulated device may be used at a time error

I setup a bot to build the project then test on all the simulators. This has been working, but today the integration had 28 errors. Each said the same thing (but for each simulator device name):
Xcode cannot launch apps on the simulated device “Resizable iPad”, as
it is currently running an app on “iPhone 5s”. Only one simulated
device may be used at a time...
After manually running the bot I received no warnings. What could cause this? (I enjoy the success streak)
I only had one project running and had the same issue. Control Quit out of xcode and start it back up.
I had this same problem. I had multiple projects open and a different one still had
'Running appName on deviceName' displayed
Currently open projects can be accessed from the Window section on the toolbar on top. Pressing the Stop button (or the command from the Product Menu) on any projects that were still 'running' freed that particular device for other projects.
Alternatively, Rebooting Xcode works as it closes all projects.
See: https://stackoverflow.com/a/22267017/5172836
I encountered the same error today with the simulator.
The only way i've find is to reboot Xcode. After that the error disappeared and the application launch corectely in the simulator.
I don't know how the error has been originally produce, but Xcode is not a reliability model, so...

After starting an application for the second time, the splash image does not disappear

I am using Worklight v5.0.5 and have created a Worklight Hybrid application; I am running the app on iOS v5.1.1, compiled with Xcode 4.6.
When I execute the application in the iPad from Xcode - the iPad connected with the USB cable to the Mac - the application starts fine, I see the splash screen and then the login page.
If I disconnect the USB cable I'm not able to run the application again. Once I kill the application from the iPad, or stopping it ib Xcode before disconnecting the USB cable, I'm not able to start it again, the application does not go past the splash image.
Similarly, if I generate an .ipa and I install the it via the IBM Worklight Application Center then the first time I start the application it is fine, but if I kill the application (click twice the home button and so on...) then the next time I start the application it won't go past the splash image as well.
Any hint?
I have noticed similar behavior, not the same scenarios as you have described. For me, this helped:
After disconnecting the device from the Mac, I have made sure to exit the app in the same manner you have and to also close the iPad (not shut down, just clicking the power button to close the display) and then try to run the app again. You can also try shutting down the iPad. If that helps, this is not a Worklight issue...
Based on comment #3 to this answer, which revealed the issue at hand:
Once creating an application - for example with the name "newApp". this value, "newApp" is referenced in several locations throughout the project - the HTML filename, in application-descriptor.xml, references to the CSS and JS files of the applications and possibly another one or two references.
Changing this value is not supported. Changing it can indeed cause what is described in this question, and other oddities. Revert the change, and the application will work.

Resources