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.
Related
I'm using version 12.4 of Xcode, and when I run my app to test it, the debugger never starts a session. When I open the Debug Navigator, the message "No Debug Session" stays, and none of the normal analytics data appears.
I am running my app through Xcode onto my iPhone 12 Pro. It requires the use of the camera, and in fact the part I need the debugger for also requires the camera, so I can't use a simulator to see if that magically fixes it.
I also looked through every setting I could find that mentioned "Debug" or "Debugger", but nothing I could find changed anything.
Also, I downloaded a random tutorial app and ran that through Xcode on my iPhone, and the debugger boots up as expected.
I am completely lost and really need a GDB/LLDB tool to debug my code, so any help is greatly appreciated, as I could not find a single person or post with a similar problem to mine, and all of the Debugger tutorials and Apple Documentation are outdated and useless.
EDIT: Here is the Scheme info I have set, I have nothing in the Arguments tab. (This is a new account so I'm not allowed to embed images RIP)
Scheme Info
Scheme Options
Scheme Diagnostics
As Matt pointed out, the debugger will not point at the app target if the Executable dropdown (in Scheme Info) is "Ask On Launch". It must have the app itself selected.
I can't launch my app anymore on Android. The iOS counterpart seems to be fine.
The full error is:
ADB0000: Could not determin the installation path for package.com.company.appname.
'adb shell pm path com.company.appname' returned.
It was working. I pulled some changes from the repo, none of which should have affected any app properties. Actually it was initially launching, but I was getting some odd behavior within the app, so I uninstalled the whole thing off of my phone. Now I cannot launch it at all. What I could find about this error was that my AndroidManifest.xml might have a typo, but I couldn't find anything that stuck out. And like I said, there shouldn't have been any changes in there recently. Any help would be greatly appreciated.
Steps I have already taken:
1. Clean and rebuild
2. restart VS
3. delete obj and bin folders
4. search for solution on here and xamarin forums
UPDATE:
I just successfully launched it on another android device. So it seems to be a problem with my Pixel 2 XL. How do I make sure all traces of the app are gone so I can start fresh?
This usually happens when you have more than one user in an Android device (I still cannot figure out why is this).
As mentioned in the comment by using the adb uninstall full.package.name command it will uninstall the app.
But there's another way which does not require command line or nothing related to that.
If you go to the Settings -> Apps and Notifications on the Android device you will be able to uninstall it from there.
Let's use the UnoQuickStart.Droid app as example here. As you can see it's already in the same state as it was yours.
Once in the App details both Uninstall and Force Stop are disabled. But do you see those 3 dots image at the right upper corner? Click on it.
This will bring you a context menu with a single option "Uninstall for all users". You can click on it with confidence.
As expected, a warning message telling you what's gonna happen. Just click "Ok".
As you can see the App is not longer installed and you will now be able to install it again.
Hope this helps.-
As per apineda's instructions, using adb unistall com.company.appname fixed the problem. I was able to get to the ADB location by navigating through Visual Studio -> Tools -> Android -> Android ADB Command Prompt.
Before I did that, I looked at the App list for my phone, which listed the app, but apparently not installed for this user. The Uninstall and Force Stop buttons were disabled and several of the fields just said loading... or something like that.
I can't seem to get my Today widget (or any extension for that matter) running in the Widget Simulator. The simulator launches and says "Couldn't Open Widget" along with
Failed to find Widget /Users/SomeUser/Library/Developer/Xcode/DerivedData/Build/Products/Debug/MyApp.app/Contents/PlugIns/MyApp.appex
I looked in Console app and I see this as well:
pkd[299]: ignoring mis-configured plug-in at /Users/SomeUser/Library/Developer/Xcode/DerivedData/Build/Products/Debug/MyApp.app/Contents/PlugIns/MyApp.appex: plug-ins must be sandboxed
But it is sandboxed in xcode! It's codesigned, sandboxed and the lot. Even if I try and deploy it on a new machine (registered as a developer machine with my developer provisioning profile), the widgets don't even show up in System Preferences.
Any idea what I need to do?
Okay finally found the problem. I was codesigning my app by hand (which had never been a problem before) since I had an intricate set of frameworks the app relied upon, and needed to hand copy them using a Copy / Runscript post-build script. Any way, it seems starting Xcode 7 at least, this no longer works as expected. The app works and codesign says the app has been signed correctly, but clearly something is happening behind the scenes that's breaking the codesignature. I ended up removing all my manual codesigning stuff and simply using Xcode's 'Copy Framework' post build step and checked 'Sign on Copy'. It's now finally working as expected.
I couldn't stop building & codesigning by hand, so I looked into Xcode build logs and found the difference :) in my case, I just added -fapplication-extension to compiler & linker flags, now it works!
Based on strangetimes's answer here a little more detailed answer:
First select your project and then your App Target (not the extension)
Then click on Build Phases, then on the top navigation on Editor,
here select first Add Build Phase and lastly click on Add Copy Files Build Phase.
That's it. Build again using the Widget Simulator and it should work now.
I ran into problem with testing my app on iOS and Xcode when I am uploading it to my actual devices (iphone and iPad), and I'm wondering if someone knows the issue and can help me out:
Normally when I build my app on my devices, the app is installed and launched on my devices. But as I am preparing for submitting my first app I was testing around and changing the Bundle Identifier, App ID, and Development Provisions (so the issue may have something to do with it), and now, when I try to build my app on my devices, although it's installed on my devices fine, Xcode will not launch the app anymore. Instead, I got this error message:
Error Starting Executable.
Error launching remote program: No such file
or directory.
Does anyone know what the issue is? And What is this derived data folder about?
Much thanks!
I have also faced that problem. I have closed, restarted Xcode; deleted the application from device and reinstalled it again, then the problem has gone.
Running App from a Clean Slate
For me the problem did not resolve until I did the following in this order:
Delete the app from the device (Do this before trying to debug again)
Quit XCode (Don't just close the project)
Delete the app build folder (example path: /Users/myusername/Library/Developer/Xcode/DerivedData/MyProject-fhkaamuyvqhubaezinqbmxbnaufd/)
Restart XCode
Finally -- Try debugging again on the iOS device
The app build folder of step 3 refers to your app's build folder that is a child of "DerivedData". To find this you can reveal your app in finder, then backtrack until you get to "DerivedData" folder and delete the folder above that like "MyApp-crazylongweirdletters". Without this step (3), I could not debug, so this is a critical step and you must quit XCode before you do this step.
For some it appears simply restarting XCode does the trick, but not for me.
I only post this answer because the earlier answers did NOT work for me. Hopefully others banging their heads will find this and get a sigh of relief. :)
Notes:
The issue started happening for me when I modified the bundle id of the app.
My code signing is and was correct. My provisioning profile was the "Team Provisioning Profile" which should work for any app id (default for "iPhone Developer" automatic profile selector).
I was doing a DEBUG build (not release / distribution).
You cant debug (start from Xcode) an application signed with a distribution profile if I remember well... And then you get such messages, gdb failling to attach to process.
I finally found my error!
I was playing around with my info.plist file, and I changed the Executable Name and Bundle and Bundle Display name! As soon as I changed those back to the Defaults (EXECUTABLE_NAME, PRODUCT_NAME, PRODUCT_NAME respectively) it worked perfectly.
Delete the app from the device (tap-and-hold then delete) and try again.
For me, none of those worked. Same error, but different solution.
My problem was cause by me accidently changing the "Deployment Target" (ios version) to a version higher than what was on the phone I tried to run the code on.
The fix was simple - drop the deployment target to below or equal to the ios software version on my phone :)
I got the same error by not having my code signing correct.
Go to your project > Targets > Build Settings > Check code signing for debug state.
I stumbled upon this as a solution to another issue whch was a warning when trying to build an app on a new 4.3.5 device.
If i set the profile to distribution I do not get a warning message when building the app, but the debugger will attach to the device.
If i set the code signing to the distribution profile, i get no warnings in the build process, but the debugger will not attach. So the answer above about being signing based seems to be correct. This might also only be an issue on newer 4.3.5 devices with xcode
Product -> Clean in the menubar
This error some times happen due to incomplete "Restore" or "Sync" process of your device which keeps the .app files locked up.
What I did I had to jailbreak my device to go find the app under /User/Applications/XXXXX-XXXX-XXX/ and phisically delete the .app
For one of the apps it worked and for other one I realized it just does not run GDB automatically so the error message is totally misleading, so I set the GDB to manual and it worked and did not give me that error, but of course I have to run the app manually for the debug session to start.
It also may have required some other stuff that I did before like checking the provision profile, but this was the last step that made it work.
Before this I tried all the solutions did not work for me, and obviously simply deleting the app by holding down your finger on the screen did not work, as it removed the icon but all the files were still there. ( Since it was a development app not a downloaded App Store app )
had same problem,
quit the XCode...delete app from device...run the program again..
i solved that way..one of my friends had to restart the device.
I have the same problem. I solved it by changing the project's directory name and then launching the app again.
I had this problem on a recently restored device where my in-development apps had not been reinstalled—they were showing up on Springboard as "Waiting" to be downloaded from the App Store. Deleting the app from Springboard fixed the problem.
I've faced this issue since yesterday on two different devices, both iOS 4.x. Deleting the DerivedData folder, deleting the app, restarting the Xcode, and cleaning the code did NOT work. Repeating all the steps, in addition to rebooting the device fixed it for me.
Here I am posting an update to the issue. Might be helpful for someone with the same problem. I have Xcode 4.4 and launched it on a device with iOS 5.0 . If Xcode doesnt have the 5.0 simulators
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.