Last Updated: 26 Feb 2015
- Types of errors: Compile Time Errors
- Types of errors: Runtime Errors
- Debugging app yourself: 101
- Debugging app yourself: Update Xcode
- Debugging app yourself: Installing Project Dependencies
- Debugging app yourself: Recreating Project Scheme
- Debugging app yourself: Most common errors
Types of errors
There are two types of errors. Compile time and Run time. If you’re not familiar with Objective C then correcting these errors will be very difficult for you. So in that case its always best to send the error logs to us. Next two sections discusses how to send the error logs to us for Compile time and Run time errors.
Types of errors: Compile Time errors
They prevent your application from being run and they can be inspected in Issue Navigator (command + 4). If you app shows a red mark with white exclamation mark inside it then its a compile time error. Fig 1.
Steps to follow in case of compile time error occurs.
- Open Issue navigator. (cmd + 4)
- There may be two sections. One under red mark and other under yellow marks. (Fig 2 A) The red ones are important. Click each error message under red marks and take screenshot of Xcode. Fig 2 B, 2 C.
- Also copy error message in each step and send it with all screenshots taken in step 2. Fig 3
Types of errors: Runtime Errors
Runtime errors occurs while app has built successfully and code is syntactically all right but due to unexpected conditions at runtime app crashes. e.g divide by zero error.
We don’t get any information on such errors via issue navigator but we get some info from console.A typical runtime error looks like Fig 4 which shows console output. Most of the time it shows error in main.m file which is inside Supporting Files group.
Steps to follow in case of runtime errors
- Show console by pressing shift + cmd + C.
- Copy the error message and send it to us.
- Also send us the screenshot.
Debugging app yourself: 101
Most basic thing you can do is
- Hit command + shift + K to clean the project and then try re-building or re-running the project.
- Sometimes error is due to misconfigured Cocoapods, follow this guide for troubleshooting Cocoapods related error. Cocoapods Advanced Troubleshooting Guide
- Also if you have accidentally misconfigured few things or changed some code, start afresh.
Debugging app yourself: Update Xcode
All apps are created from latest Xcode so for smoother setup its recommended to have latest Xcode on your system too. Steps are:
- Open App Store on your Mac.
- Under updates section check for any pending system updates.
- Type this command on Terminal
If it says
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Then your Xcode is updated
- Else it will open a dialog which will ask you to install Xcode command line tools similar to image below. Click Install to download and install them. Its heavy and it will take time depending upon your internet connection speed.
Debugging app yourself: Installing Project Dependencies
Many times our project build fails only due to some misconfiguration, missing components/files or old libraries. For this all iOS projects are built over Cocoapods, which is a dependancy manager and takes care of all of the above problems.
Introduction to Cocoapods
So Cocoapods is a dependancy manager (just like rubygems). It is based on Ruby and mac comes with Ruby and so you can just type
sudo gem install cocoapods
to install it. More information on http://cocoapods.org/.
If you already have a version of Cocoapods installed then try updating it by running same command.
Now opening .xcworkspace file combine two projects into one. The iOS App and its dependancies. In the project navigator you can see them as two large blue icons at root level of tree. The latter is always called Pods. Inside it you’ll find a file called Podfile and if you open it you’ll find name and version of all dependancies. A sample file looks like this.
target ‘FBDemoSDK’ do
pod ‘Facebook-iOS-SDK’, ‘~> 3.20’
target ‘FBDemoSDKTests’ do
It says that App FBDemoSDK app requires Facebook-iOS-SDK to be installed. ‘~> 3.20′ means that it will install versions 3.20 onwards upto 3.29.
pod ‘Facebook-iOS-SDK’, :head
above line will always install the latest bleeding edge version on the SDK which might be risky sometimes but beneficial also. (more info: http://guides.cocoapods.org/using/the-podfile.html)
So if you get errors related to some libraries used then this is you’re going to do first.
- Open terminal.
- Close Xcode.
Navigate to your directory.
Type this command
(Note: As of current version of Cocoapods you’ll need at least Ruby 2.1 for this to work correctly. Please check cocoapods.org for the correct version of Ruby to be used.)
this command will take some time to update dependancies or install missing dependancies. Be patient until it finishes.
If the above method also fails then try updating the Pods by typing this command
Debugging app yourself: Recreating Project Scheme
Go here Xcode Schemes
Debugging app yourself: Most common errors
ld: library not found for -lPods
– Generally this happens when Xcode is unable to locate your Pods.
– Most common case is when you open blue icon (.xcodeproj file) and not the white icon (.xcworkspace file). Remember .xcworkspace file combines your project with Pods and make it complete. Open your project by double clicking the white workspace file and not the blue file.
– Another cause can be misconfiguration. Discard the content of that folder and start afresh. Unzip your project folder and run pod install while Xcode is closed. Running pod commands while Xcode is open may also cause this error.