Debugging iOS app built from commandline - objective-c

I am building an app for iOS via commandline but I am having problems debugging it. Had I built using XCode, it would have let me "build and debug" on device without problems. But now, I don't know how to launch it on device using gdb and step through it. If I try to "add a custom target/executable" to a blank XCode project and then launch it, XCode complains about not finding the executable. Same thing happens if I install the app on device manually and try to attach to it using gdb within XCode. Any pointers on how to go about debugging this app? Changing the build process to use XCode is not an option.

This site gives a nice tutorial on how to manually set up a remote debugging session on an iOS device. The process boils down to creating a remote debugging server on the device and attaching to it with a local GDB instance.

Related

React native takes very long to load on device

I've been developing a react-native app using the simulator for a while. On the simulator (iOS), the app loads very fast (on reload for eg). However, when I tried to load the app to the device, it spends between 1-3 minutes in the splash screen before loading into the app.
My project is fairly small, and has no extra resources other than the javascript. Looking at the documentation I couldn't find what might be the cause of the issue, though I suspect it has to do with the fact that it is not getting the JS from the packager local server.
What am I doing wrong?
(btw - react-native v0.31)
I ran into the same issue and discovered that it was because I was running my app on device in development mode. To get the performance you're looking for, you'll need to build and run the app in production or "release" mode. You can do this by passing in a --configuration option and setting it to Release using the React Native CLI:
$ react-native run-ios --configuration Release
If that doesn't do the trick, then you may need to build your app in "Release" mode from Xcode. To do that, navigate to your projects /ios directory and open the .xcodeproj file in Xcode. Choose your build target in the Toolbar. Scroll to the bottom and choose "Edit Scheme...". Then under Build Configuration, switch from "Debug" to "Release". Now build your app on your target device and it should be much more performant than before.
You can read more in the official React Native documentation under Running on Device: Building your app for production.
For me the issue was related to the wifi network of my development machine. I was using WPA2 Enterprise auth to connect to wifi on my development machine. I found that if I used a wired connection to connect to my network or if I used another wifi connection that used a different form of auth then the delay went away. I think the delay is a network timeout.

App crashing on launch with instrumentation w/ calabash-ios

UPDATE: This was fixed by resetting the phone's settings. General -> Reset -> "Reset all settings".
We are having on issue on iPhones 6 and 6+ when launching our IBM MobileFirst-based app.
When calabash instrumentation is linked and I manually launch the app, the splash screen will come up and the app will quit almost instantly.
Double tapping home shows me the app running in the background, but Xcode does not recognize it as a running process. After force-closing the app and re-launching, it will usually do the same thing, but sometimes it comes up.
I've noticed our automation is sometimes stuck in an infinite loop of launching and crashing. This only happens on the instrumented app.
The crash log throws EXC_BAD_ACCESS. I found a thread on the google group from a few years back that talks about linker flags, but I don't have any of the weaker flags mentioned there.
Steps to reproduce:
*App must be instrumented with the calabash automation framework (calabash-ios setup must have been executed in same directory as xcodeproj file.)
Build application and deploy native iOS project to XCode via eclipse.
Build the -cal target with the "Run" configuration.
Kill the debugger/application.
Manually launch the app on the device. The app will successfully launch maybe 15%-20% of the time, otherwise it will just quit.
Using calabash-cucumber version 0.14.3.
Linker flags:
$(inherited)
-force_load
"$(SRCROOT)/calabash.framework/calabash"
-lstdc++
It appears $(inherited) contains -ObjC for Debug.
Xcode installed at: /Applications/Xcode.app/Contents/Developer
Xcode version: 6.1.1
Xcode build: 6A2008a
The user is unresponsive, the fix was:
Actually I just found the fix to this. What I had to do is reset the
phone's settings in Settings -> General -> Reset -> "Reset All
Settings" (the first option). Have not seen the behavior since.
I had exact same problem, tried so many different ways and finally found how to fix it - I changed project directory, pulled from Git, then bundle install, pod install and build the app with calabash target as usual
Xcode 7.3.1, calabash-cucumber (0.19.1)

xcode timed out waiting for app to launch

Application get fail to launch in device having iOS 6.0 from xcode 4.5. Xcode says Application can't be launched timed out waiting for app to launch. I reset my all device settings. Cross checked if i choosed right provisioning. Yes, its right. here i am attaching image of console. Please help me out.
None of the above tips helped me. It turned out I was using my Distribution Profile instead of the Developer Profile in Debug mode. You can check the Profile you are using by going to
Build Settings->Code Signing Entity.
Make sure you are using your Developer Profile in Beta and Debug mode.
I had a similar issue when trying to debug an App with Ad-Hoc provisioning... Check which provisioning you're using, it seems ad-hoc provisioning cannot be used for debbuging.
Whenever this happens to me, I have done the following to fix the problem:
Stop the app from running in Xcode.
Delete the app from the device (or Simulator).
Select Product > Clean from the Xcode menu.
Close Xcode.
Close the Simulator (or restart the device).
Restart your computer (yes I know this like a Windows solution but seriously).
Try again.

Install an IPA through USB?

After using the "iPhone Configuration Utility" program to install IPA applications to my iPhone on the go, I wondered how this process worked. Within a few Google searches, I found out about "MobileDevice.framework" and the "MobileDevice Library" connected to it. After reading an article of all the Known Functions in the library, I found one called "AMDeviceInstallApplication". I thought this would work once I saw install, but I'm currently perplexed on how to use it.
TL;DR I have IPA files and I want to make an Xcode program (for Mac) that installs the IPA's application to a connected iOS device when a button is pressed.
Also, don't worry about the application not being signed correctly. It is signed with a provisioning profile installed on devices [the application] will be used with.
If you're still interested in this problem I've written a blog entry on how to install apps on a connected iPad / iPhone without using Xcode or iTunes.
This method allows you to run a Terminal command to install an iPA file.
http://pervasivecode.blogspot.co.uk/2012/06/install-ios-app-ipa-file-without-xcode.html
I suppose you could bundle up the terminal commands in your application and use it that way?
I found a simple way to install iPa file to real iPhone or iPad:
Connect iPhone to Mac via USB and follow the below steps:
Steps to follow:
Open Xcode
Click on Window
Select Devices and Simulators
Drag and drop the IPA files into it
App got installed on the iPad

Cannot Install into iPhone Simulator

I've got an Xcode project that I've been working on over the past few weeks.
I just made some changes to an embedded framework that I'm working on (recompiled, to be specific) now, however, I am unable to launch the application in the simulator.
The app hangs on "Attaching to [app name]," if I have a debugger on. If I don't have a debugger on, Xcode just says the app has finished running.
There is no icon installed on the device.
Here's what I've done so far:
Restarted
Reset simulator
Clean and build
Deleted derrived data
I cannot install onto a device either, but then I get an error:
Error launching remote program: No such file or directory (/Users/peter/Library/Developer/Xcode/DerivedData/x-gtwuuwmavjonyrcxjmpcletdpyjw/Build/Products/Debug-iphoneos/x.app/x).
Oddly enough, what worked was installing another app in the sim (just launched another project and ran it) and then launching the other app in the sim.
I'm not sure what the issue was, but I tried it on two computers and it was hanging on each, so it was related to the project rather than the simulator. There's an issue to think about...