iphoneapp

How to submit an iPhone App to iTunes store

Prerequisites

Download PDF

You need

  • – Paid Developer account
  • – Any Mac device running OSX
  • – Latest Xcode and command line tools

Steps

A. Create Distribution Certificate

You need to create iOS Distribution Certificate to be able to upload apps on app store.
1. Go to Apple Developer website (http://developer.apple.com/) and Sign in to your Apple Developer Account by clicking the member center in the menu bar.
2. Click on Certificates, Identifiers & Profiles.

How to submit an iPhone App to iTunes store
[Fig 1]

3. On the left hand side click on Certificates > All.

How to submit an iPhone App to iTunes store
[Fig 2]

4. Click on the plus icon at the top right to add a new Certificate. Select App Store and Ad Hoc under Production. Click Continue.

How to submit an iPhone App to iTunes store
[Fig 3]

5. Now you need to generate a Certificate Signing Request (CSR) using Keychain and next screen will tell you the required steps.

How to submit an iPhone App to iTunes store
[Fig 4]

6. According to it you need to open Keychain Access App in you mac device and then select Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority.

How to submit an iPhone App to iTunes store
[Fig 5]

7. It will ask you for your email address (used to sing for Apple Developer Account) and Name. Leave CA Email field blank and select Saved to disk. Click continue.

How to submit an iPhone App to iTunes store
[Fig 6]

8. Next it will ask for a location to save the file. Save it at any location. Now resuming from step 5, click continue and it will ask to upload the file you generated just now. Upload the file and click Generate.

How to submit an iPhone App to iTunes store
[Fig 7]

9. Make sure you have Xcode open. In the next screen download the Distribution Certificate and double click it to load it in Xcode. Actually nothing happens when you double click the certificate file but it will be loaded into Xcode.

How to submit an iPhone App to iTunes store
[Fig 8]

B. Create App ID

App ID uniquely identifies your app in App Store. It is generally written in reverse domain notation. e.g. if your app name is My iOS App and company URL is abccorp.com then your bundle identifier can be com.abccorp.my-ios-app.

1. Find your App’s Bundle Identifier (See Fig 9)

1. Bundle Identifier can be found in Xcode. Open your project and in Navigator Area click the project name at the top.
2. On the right the project settings will open. Click the app name under TARGETS.
3. Make sure the selected tab is General at the top.
4. Now under Identity panel you will see Bundle Identifier.

How to submit an iPhone App to iTunes store
[Fig 9]

2. Now you have to create App ID in Developer center. Login to Developer center and click Certificates, identifiers and Profiles. Now On the left column under Identifiers click App IDs. It will list all your App IDs on the right.

How to submit an iPhone App to iTunes store
[Fig 10]

3. Click the plus icon on top right to add an App ID. It will ask for name and bundle identifier. Type any name (preferably name of your app) and bundle identifier from Step 1. The Bundle Identifier should be exactly same here. Take care if you have put additional spaces etc. Click continue to go to next step.

How to submit an iPhone App to iTunes store
[Fig 11]

4. Verify information and press Submit to add the App ID.

How to submit an iPhone App to iTunes store
[Fig 12]

C. Create Provisioning Profile

You have to create a distribution provisioning profile to distribute an app on App Store. For this you need App ID and a distribution certificate so create this after creating both.

1. Login to Developer center and click Certificates, identifiers and Profiles. Now on the left column under Provisioning Profiles click All. It will list all your Provisioning Profiles on the right.

How to submit an iPhone App to iTunes store
[Fig 13]

2. Again click the plus icon at the top right to create a new provisioning profile. Check the App Store option under Distribution heading. Click continue.

How to submit an iPhone App to iTunes store
[Fig 14]

3. It will ask you to select the App ID for your app. Do that and click continue.

How to submit an iPhone App to iTunes store
[Fig 15]

4. Now select the distribution certificate you created earlier and click continue.

How to submit an iPhone App to iTunes store
[Fig 16]

5. Next name the provisioning profile (add the app name in it so that you can easily locate later in Xcode) and click Generate.

How to submit an iPhone App to iTunes store
[Fig 17]

6. In next step download the Certificate and double click to load it into Xcode. Xcode must be open before you open this file.

How to submit an iPhone App to iTunes store
[Fig 18]

7. Load your project in Xcode. Click the project root in Navigator area (Fig 19-1). Select the App target (Fig 19-2). Click general tab (Fig 19-3). Select the team from Team dropdown (Fig 19-4). Every developer account have a default team with same name as the Account Developer name. You must be able to view that team name in this dropdown.

How to submit an iPhone App to iTunes store
[Fig 19]

8. In case no team is listed you have to add your developer account in Xcode. It can be done by going to Xcode > Preferences. Xcode preferences will open in a dialog (Fig 20). Click the accounts tab (Fig 20-1). See if your Apple Developer ID is listed in Apple IDs panel on left (Fig 20-2). if its not there then click plus button on bottom left (Fig 20-3) and select Add Apple ID.… Restart Xcode if needed. Now in Step 7 your team will be listed in Team dropdown.

How to submit an iPhone App to iTunes store
[Fig 20]

9. Now is the time to connect the app to its Provisioning Profile which we created earlier. Again under Build Settings tab (Fig 21-3) type provisioning profile (Fig 21-4) and you will get Provisional profile dropdown (Fig 21-5). Click the dropdown to select the provisioning profile you generated earlier.

How to submit an iPhone App to iTunes store
[Fig 21]

10. One last caveat. If you’re familiar with bitcode optimisation then go for it else you have to disable it. To disable it go to Build Settings (Fig 22-3) and search for bitcode (Fig 22-4). Change the Enable Bitcode field to No (Fig 22-5).

How to submit an iPhone App to iTunes store
[Fig 22]

C. Create new App in iTunesConnect.

Before submitting the App you must create an App entry in iTunesConnect.

1. Login to iTunesConnect account (itunesconnect.apple.com) using your developer account credentials. Click My Apps. It will list all your apps.

2. Add a new app by clicking the plus icon (+) at top left and choosing New App from the dropdown menu.

How to submit an iPhone App to iTunes store
[Fig 23]

3. A dialog box will appear and it will ask you details about your app and click Create.

How to submit an iPhone App to iTunes store
[Fig 24]

1. The name field must be unique. You can use a descriptive name with keywords.
2. Bundle ID will show a dropdown with all App IDs you can use to create this app. Choose the correct one you create earlier.
3. SKU is also a unique identifier for your app which is not visible on App Store.
1. The name field must be unique. You can use a descriptive name with keywords.
2. Bundle ID will show a dropdown with all App IDs you can use to create this app. Choose the correct one you create earlier.
3. SKU is also a unique identifier for your app which is not visible on App Store.

4. Fill all mandatory fields in App Information and hit Save button on top right.

How to submit an iPhone App to iTunes store
[Fig 25]

5. The fill the Pricing and Availability on the left column and again fill all mandatory fields.

How to submit an iPhone App to iTunes store
[Fig 26]

6. In the same step check the Bitcode Auto-Recompilation options. If you don’t have it check Don’t use bitcode auto-recompilation. Hit Save.

How to submit an iPhone App to iTunes store
[Fig 27]

7. Now click Prepare for submission option on the left column. Here you upload App Screenshots, Description, Keywords, App Binary etc. Fill all required fields and hit save. You will be able to submit app only if all mandatory fields are filled properly. Also you need special instruction to upload a binary to this app which we will discuss separately. Be sure to read the Apple Guidelines on App Icon, App meta data and App screenshots. You can also upload App video here.

How to submit an iPhone App to iTunes store
[Fig 28]

C. Upload Build to iTunes

This step is accomplished via Xcode or Application Loader (which is also part of Xcode tools). Here we will discuss only the Xcode method. Before this step your App should have valid AppIcons. (see this tutorial – http://mobilemerit.com/ios-changing-the-app-icon/)

1. Open your app in Xcode. Connect any compatible device and select that device in Scheme Menu in Xcode (Fig 29-1).

How to submit an iPhone App to iTunes store
[Fig 29]

2. Select Product > Clean. Then Product > Build. Then Product > Archive. When archive command is completed the it will open Organiser window. Organiser window can also be opened from Window > Organiser. Organiser window will show your archived app on left side and all of its versions in main middle panel. Click Upload to App Store button on the right column.

How to submit an iPhone App to iTunes store
[Fig 30]

3. It will ask to select the account (Fig 31). After that it will verify all certificates and iTunes App ID and if all is good then you will see a dialog with upload option (Fig 32). Uncheck Enable Bitcode option if you’re not using BitCode optimisation (Fig 32). Click Upload button and it will start to upload (Fig 33). It may take anywhere between 15 mins to 1 hour depending upon size of your app. Please be patient.

How to submit an iPhone App to iTunes store
[Fig 31]

How to submit an iPhone App to iTunes store
[Fig 32]

How to submit an iPhone App to iTunes store
[Fig 33]

4. When your upload is complete then you can view your binary under Activity tab.

How to submit an iPhone App to iTunes store
[Fig 34]

5. If it says processing then wait for some time until the text (Processing) goes away. The you’ll be able to add a build in App Store tab under Prepare for Submission. Fig 35. You’ll now see a plus icon after Build title clicking which will open a modal listing all the valid builds uploaded via Xcode. Fig 35. Select appropriate build and press Done and it will be added to builds.

How to submit an iPhone App to iTunes store
[Fig 35]

6. Now you can press the Submit for Review button to submit the app to App Store. Lastly it will ask about encryption and ads. Fig 36 & 37. Answer them and click Submit at top right.

How to submit an iPhone App to iTunes store
[Fig 36]

How to submit an iPhone App to iTunes store
[Fig 37]

7. After this App Status is Waiting for Review. During this period your app will be in queue waiting to get reviewed from Apple Engineers. It may take upto one week to get the feedback on App.

ipad-app

iPad App Development

iPad is a large screen mobile device from Apple. The latest iPad model has a 12.9 – inch Retina display, a fast CPU and graphics performance. It has several advanced software and hardware features like mult-itasking, four audio speakers, multi-touch etc that add very good experience to mobile apps and games.

iPad App Development

Multitasking help users get more done more easily, and takes advantage of the large display on iPad to create new experiences with two iPad apps running at the same time.

iPad from Apple is the most popular mobile device and our iPad app development service provides advanced app development focused especially for large screen devices. The app we develop for iPad maximizes the use of large screen and available hardware and software features of iPad

Our expertise in mobile app development includes:

  • Objective-C
  • Xcode
  • Swift
  • MacOS
  • Unity
  • PhoneGap
  • Apple TV
  • Push Notification
  • iTunes Store
  • Google Map
  • Google ads
  • Custom API’s
  • Split View
  • Picture in Picture
  • Slide Over

We provide complete end to end iPad development service from conceptualization to UI design for large screen to actual coding of app in Swift language to launch of iPad app in iTunes.

Over the past few years we have developed over 600 wide ranging apps for clients based worldwide.

Consult with our ipad application development specialist at:

http://mobilemerit.com/contact-us/

About iPad:

https://developer.apple.com/ipad/

getting_swift

Getting started with Swift

If you are comfortable with playground file I would strongly suggest to use this Interactive Playground File from Apple

Requirements

  • You need latest Xcode (Xcode 6 or up)
  • And for that you must have Yosemite (i.e. Mac OS 10.10 onwards)

Hello World

println("Hello, world!")

Variables and Constants

Define variables using var keyword var myVariable = value

Swift compiler will try to assign the type to myVariable based on the return type of value.

Define constants using let keyword let myConstant = value

If you do not want to assign a value yet to a variable then you have to hint the compiler of the object type. var myVariable: Dictionary

String interpolation

You can include a variable inside a string by using either of these syntax let myStringVar = "Hi"

Using + operator let myText = myStringVar + "!! Man"

Using () for string interpolation let myText2 = "\(myStringVar)!! Man"

Array Dictionary Tuples and other variable types

Arrays let todoItems = ["Go grocery", "Print important Docs", "Call Samantha"]

Dictionary let todoItems = ["important": ["Call Arun", "Reply to Samuel"], "not important": ["Go grocery", "Call Mom"]]

Tuples let myTuple = (3.14, "circle", "radius")

Tuples also contain multiple values but they can be any type. Array value must be of same type. Its helpful when a function returns multiple values.

Also tuples can also be defined as let (pi, shape, variable) = myTuple

and then you can access variables pi, shape and variables separately.

Constructors for base types

If you wish to initialise an empty array or dictionary, here is how its done. var todoItems = [String]() var todoItems = [String: Array]()

Conditionals

If statement

if condition1 {
} else if condition2 {
} else {
}

Switch

switch valueToCompareFrom {
case "value1":
// Do somethinghere
case "value2", "value3":
// Do something else
case let a where a.hasSuffix("novalue"):
// Handle it differently
default:
// This runs if none of the above case matches
}

Loops

For in loop

for item in arrayVar {
}

There are c like while and do-while loops also.

Functions

func myFunc(param1: String, param2: Int) -> String {
return "Hello \(param1), count \(param2)."
}
myFunc("John", 400)

Functions now can be nested. Functions are first class type and so a function can return another function and also can take another function as argument.

Classes and Inheritance

class Electronics: Thing {
var voltage = 220
init(volatge: Int) {
self.volatge = voltage
super.init()
}
func worksWithVolatge(volatge: Int) -> Bool {
return self.volatge == voltage
}
}
var computer = Electronics(100)
computer.voltage = 110
computer.worksWithVoltage(220) // returns false

Here class Electronics inherits from Thing class. init function is a constructor function Member variables can also have getters and setters. Static variables are defined using static keyword. Static functions are defined using class keyword.

Optional values

Optional values are a part of Apple’s type safety.

Gadget? is an optional type for Gadget class. It means that the instance variable is wrapped inside a construct which may return nil.

let optionalGadget: Gadget? = Gadget(voltage: 100)

You can’t access the the instance variable directly. You have to first unwrap it using the ? operator. If its nil then the assignment will fail. let voltage = optionalGadget?.voltage

Enums

enum iPhone: Int {
case Four = 1
case FourS, Five, FiveS, FiveC, Six, SixPlus
func printDescription() -> Void {
switch self {
default:
println(self.rawValue)
}
}
}

The value of a enum can be accessed by .rawValue property. Instance of an enumeration from a raw value can be made by following constructor. let iPhone5s = iPhone(rawValue: 4)

Extensions

As the name suggests it adds functionality to an existing class.

extension Int {
var simpleDescription: String {
return "The number \(self)"
}
mutating func adjust() {
self += 42
}
}
println(7.simpleDescription)

introduction_swift

Introduction to Swift

Introduction to Swift

Official Page: Swift Language

Apple released Swift in mid 2014 and the aim was to ease the development process by introducing a language which is more readable, compiles faster and fun to work with. Some of its advantages are

Readable and Concise

  • In the web world Javascript is eating all other languages and so Apple guys made swift look more like Javascript.
  • Readable code is easier to scan and comprehend. So in Swift
    • Cleaner sytax for defining variables and blocks.
    • Header files were removed and modules were introduced.
    • Message passing syntax was removed.
    • Type guessing was introduced. Objects now were able to guess their type when first initialised.
    • Modules were auto imported.

Language Features

  • Better type safety.
  • Better Memory Management.
  • New types like tuples.
  • New functional paradigms like extensions.

Interoperability

  • Swift introduced Bridging headers which lets you include Objective C header files.
  • Now you can use the Objective C libraries without waiting it to get rewritten in Swift.
  • Converting large apps written in Objective C to Swift becomes smooth. You can iteratively convert your app to Swift.

Performance

  • Apple boasts about Swift performance in terms of compile and run times.

Opensource

  • Swift project is now open source. This ensures that the language will evolve in a best possible way.

Playgrounds

  • Playgrounds were introduced by Apple which are self contained sandbox apps. You can test your code in a playgroud file and view the output on the fly without compiling the whole thing.
  • As they are interactive, people have written books and tutorials on Swift using a single playground file.
  • You can write your interactive app documentation there.

Cons

Cons are generally bugs which will get fixed over a period of time.

  • Sometimes Xcode displays misleading errors and warnings.
  • Third party apps need to support Swift.
Getting started 2D game programming

Getting started 2D game programming

Getting started 2D game programming

Game programming is too easy in iOS with Sprite Kit as it handles all physics for you. You just need to get acquainted to few concepts in Sprite Kit and anyone can develop a 2D game inside it. Besides its pure fun. Some resources to get started are:

Sprite Kit Swift Tutorial for Beginners

https://www.bloc.io/tutorials/swiftris-build-your-first-ios-game-with-swift

http://www.gamefromscratch.com/post/2014/06/03/Game-development-tutorial-Swift-and-SpriteKit-Part-1-A-Simple-iOSMac-OS-App.aspx

Using NSOperation and NSOperationQueues

Using NSOperation and NSOperationQueues

As iOS devices have less resources in terms of memory, all long running and secondary task should not be run in the main thread. Running any long process in main thread causes it to block and app becomes unresponsive and thats uncool from UI perspective.

A solution is to use dispatch_async but that doesn’t gives control on the thread. We can’t schedule thread and once its launched it can’t be stopped or paused.

In such cases NSOperations comes into play. It’s a high level wrapper to threads in iOS and you can schedule them, control number of threads launched at a time, number of process to run at a time, cancel a thread, reschedule a thread, pause a thread, make a thread dependant on other thread to ensure the correct flow. This cleans the app structure and gives us a greater control over threads and also makes app less buggy.

A classic data structure to use to handle NSOpeations and NSOperationQueue in a clean way is described in following link:

http://www.raywenderlich.com/19788/how-to-use-nsoperations-and-nsoperationqueues

How To Customise The Button Toolbar For IOS App For Mobile Website

How to customise the button toolbar for iOS App for mobile website

1. Go to Main_iPhone.storyboard

2. Press control + alt + cmd + 3 to show the object library on bottom right.

3. Search for bar button item. Drag it to the desired place in toolbar inside storyboard.

How to customise the button toolbar  for iOS App for mobile website

4. Each bar button item must have a flexible space bar button item around it. Drag one to the right place.

How to customise the button toolbar  for iOS App for mobile website

5. Press alt + cmd + enter to show assistant editor and set it to automatic and open ViewController.h there.
6. Ctrl + drag from new bar button item to the ViewController.m on the right at the end of the file but before @end statement.

How to customise the button toolbar  for iOS App for mobile website

7. A popup will appear. Select Action in Connection dropdown and name the connection and hit connect.

How to customise the button toolbar  for iOS App for mobile website

8. A new line will be added with a double dot on its left.

How to customise the button toolbar  for iOS App for mobile website

9. Now go to ViewController.m and search for the string newItem. This is an IBAction where you can write the logic to be performed when anyone click this button.

Changing Images.

1. Click a Bar button Item and press alt + cmd + 4 to show the property inspector on the right. There is an image field which has name of the image. Note that name down.

How to customise the button toolbar  for iOS App for mobile website

2. Go to image.xcassets and find the image. Replace the images by draggin and dropping to the thumbnails from finder. The icon must be in 3 sizes 30x30px (1x) 60x60px (2x) and 90x90px (3x).

How to customise the button toolbar  for iOS App for mobile website

3. Add and image in images.xcassets by clicking the plus icon in the left bottom and then selecting New Image Set.

How to customise the button toolbar  for iOS App for mobile website

4. Rename the new image by single clicking on its name. Also drag and drop icons of same size as done in step 2.

How to customise the button toolbar  for iOS App for mobile website

4. With the new bar button item selected, press alt + cmd + 4 and clear out the title field. In the image field type the name of new image you just created to change the icon of new bar button item.

xcode

How to manage Xcode Schemes

Official Apple guide is here
https://developer.apple.com/library/ios/documentation/ToolsLanguages/Conceptual/Xcode_Overview/chapters/RunYourApp.html

Scope

  1. What are schemes?
  2. Correcting Schemes.

What are schemes?

In Xcode schemes are used to modify the way a app is run or tested. You can add actions in form of shell scripts and email actions, before and/or after different phases of app like compilation, run, test, profiling etc. See Fig 1. Additionally you can pass custom arguments to your app, change the environment variables etc. You can explore things yourself by expanding the arrow and clicking on different sections.

How to manage Xcode Schemes

Fig 1

Correcting Schemes

There are times when a scheme gets corrupted due to things like renaming an app or sometimes schemes changes automatically while opening Xcode project. The best thing to correct such errors is to create a new scheme.

  1. Creating a new scheme
  2. Click the Scheme area in toolbar (Adventure iOS in Fig 2).
  3. A menu will open (Fig 3). Click new scheme from the menu.
  4. It will open a window in the middle (Fig 4) with the new scheme name and target. Set the target to AppName and click OK to create it.

Note# Some apps throws error on AppNameTest target which it should not throw as AppNameTest Target is not usable in most of the apps. To remove that error go to edit scheme > build > build and uncheck the Run column under AppNameTest column. (Fig 5)

How to manage Xcode Schemes

Fig 2

How to manage Xcode Schemes

Fig 3

How to manage Xcode Schemes

Fig 4

How to manage Xcode Schemes

Fig 5

launch

How to change App Launch Image in iOS

Requirements

  • 1. Mac System: Mac Mini, iMac, Macbook pro or Mac pro
  • 2. Xcode 6.0 or higher (Setup guide)
  • 3. Project Code in Objective C
  • 4. Basic knowledge of programming in Objective C and know how of using Xcode
  • 5. Basic Knowledge of Photoshop.

Steps

  • Launch Image is an image which shows when your app is loading. Duration depends on your app. but generally for light apps like this it displays for 1-5 seconds. If you don’t set a launch image then a black screen is displayed and the user may think that your app is buggy or not functional or slow. Its not a good practice to not have a launch image and if you’re submitting your app to app store then its required else it will be rejected.
  • Changing a launch image is similar to changing App Icon. The bundle you get has default launch image set. Generally it can be your company logo you used in App Icon and your company name and/or app name. Here are the things you might take care while designing the launch app. #launch-image-hig. You will need following sizes in PNG format.

How to change App Launch Image in iOS

Generating the Launch Image:

Go to https://github.com/electriccode/iOSLaunchImages. It will
open a Github project page. Click the “Download ZIP” button. It will help you generate the Launch
Images for all sizes based on your App Logo. Help Video show how to use it.

Replacing the Launch Image:

  • 1. Open the Images.xcassets file in Project Navigator (quick open by cmd + shift + O) (Fig 1 -1). It will open navigator area where all images are listed.
  • 2. In navigator area click “LaunchImage” (Fig 1 – 2) which will show you the current launch images (Fig 1 – 3).
  • 3. Replace them by your version of images by dragging and dropping from finder (Fig 1 – 4).

How to change App Launch Image in iOS

app-icon

How to change the App Icon in iOS

Requirements

  • 1. Mac System: Mac Mini, iMac, Macbook pro or Mac pro
  • 2. Xcode 6.0 or higher (Setup guide)
  • 3. Project Code in Objective C
  • 4. Basic knowledge of programming in Objective C and know how of using Xcode

Steps

Generating the Logo: Goto appicontemplate.com/ios8. Download the PSD template from there.
The help video has the instructions on how to create and generate App Icons from it.

Replacing the AppIcon:

  • Open the Images.xcassets file in Project Navigator (quick open by cmd + shift + O) (Fig 1 -1). It will open navigator area where all images are listed.
  • In navigator area click “AppIcon” (Fig 1 – 2) which will show you the current app icons (Fig 1 -3).
  • Replace them by your version of icons by dragging and dropping from finder (Fig 1 – 4).
  • Tiles labelled as 1x will have the specified size. e.g. Tile labeled 1x under iPhone 29pt will have
    AppIcon of size 29px. Tiles labelled as 2x will have AppIcon of double the size mentioned. e.g. Tile labelled 2x under iPhone size will be 87px (29 x 3).

You’ll need icons in PNG format and with these sizes to support iOS 7 and 8.

How to change the App Icon in iOS

pasted-image

app_changing

How to change the App name of iOS App

Requirements

  • 1. Mac System: Mac Mini, iMac, Macbook pro or Mac pro
  • 2. Xcode 6.0 or higher (Setup guide)
  • 3. Project Code in Objective C
  • 4. Basic knowledge of programming in Objective C and know how of using Xcode

Steps

  • 1. Go to Project target (cmd + 1).
  • 2. Click the blue icon at the top of project navigator (Fig 1 – 1).
  • 3. Click the App target, which is generally the item with name same as project name listed under targets section (Fig 1 – 2).
  • 4. Select the Build Settings tab (Fig 1 – 3).
  • 5. Search for term “Product Name” (Fig 1 – 4).
  • 6. Change the value on the right y double clicking it and overwriting the text in popover (Fig 1 – 5).

How to change the App name of iOS App

Help Video

debug

How to debug iOS app

Last Updated: 26 Feb 2015

Scope

  1. Types of errors: Compile Time Errors
  2. Types of errors: Runtime Errors
  3. Debugging app yourself: 101
  4. Debugging app yourself: Update Xcode
  5. Debugging app yourself: Installing Project Dependencies
  6. Debugging app yourself: Recreating Project Scheme
  7. 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.

How to debug iOS app

Steps to follow in case of compile time error occurs.

  1. Open Issue navigator. (cmd + 4)
  2. 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.
  3. Also copy error message in each step and send it with all screenshots taken in step 2. Fig 3

How to debug iOS app

How to debug iOS app

How to debug iOS app

How to debug iOS app

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.

How to debug iOS app

Steps to follow in case of runtime errors

  1. Show console by pressing shift + cmd + C.
  2. Copy the error message and send it to us.
  3. Also send us the screenshot.

Debugging app yourself: 101

Most basic thing you can do is

  1. Hit command + shift + K to clean the project and then try re-building or re-running the project.
  2. Sometimes error is due to misconfigured Cocoapods, follow this guide for troubleshooting Cocoapods related error. Cocoapods Advanced Troubleshooting Guide
  3. 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:

  1. Open App Store on your Mac.
  2. Under updates section check for any pending system updates.
  3. Type this command on Terminal

    code-select —install
    
  4. If it says

    
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

    

    Then your Xcode is updated

  5. 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.

How to debug iOS app

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.

source ‘https://github.com/CocoaPods/Specs.git’
target ‘FBDemoSDK’ do
pod ‘Facebook-iOS-SDK’, ‘~> 3.20’
end
target ‘FBDemoSDKTests’ do
end

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)

Installing dependancies

So if you get errors related to some libraries used then this is you’re going to do first.

  1. Open terminal.
  2. Close Xcode.
  3. Navigate to your directory.

    cd /path/to/your/project/folder

  4. Type this command

    pod install

    (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.

  5. If the above method also fails then try updating the Pods by typing this command

    pod update

Debugging app yourself: Recreating Project Scheme

Go here Xcode Schemes

Debugging app yourself: Most common errors

  1. 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.

admob8

How to Add Admob in iOS app

Official Documentation:

https://developers.google.com/mobile-ads-sdk/docs/admob/ios/quick-start

Requirements

Scope

  • 1. What you need to know
  • 2. Finished app preview
  • 3. Include the Google AdMob SDK using cocoapods
  • 4. Adding Banner View
  • 5. Test devices

What you need to know

  • 1. Storyboards
  • 2. Views
  • 3. View Controllers
  • 4. Layout Constraints

Finished app preview

How to Add Admob in iOS app

Include the Google AdMob SDK using cocoapods

  • 1. Create a new Xcode project if you haven’t and then close it. If you have an existing project then
    close that project in Xcode. We are going to open it again in different way.
  • 2. Open terminal and type following command and press enter
    sudo gem install cocoapods
  • 3. Now go to your project directory through terminal
    cd /path/to/your/project/folder
  • 4. Initialise Cocoapods by typing this command
    pod init
  • 5. A new file named Podfile will be created in your application’s root. Open it in Xcode or any text
    editor. It will look like Fig 2 only difference being the project name in line 6 and 10.
  • How to Add Admob in iOS app
  • 6. Now add this line between line 6 and line 8 i.e. inside the target ‘YourProjectName’ do section.
    pod 'Google-AdMob-Ads-SDK', '~> 6.12’
  • 7. Go back to terminal and navigate to your project directory if you aren’t in it. Then type this command.
    pod install
  • 8. Output of this command will be like Fig 3. It says at the last line that you have to use
    ‘ProjectName.xcworkspace’ from now on. A new file with white icon is created and its called workspace file which group and integrate your Project and GoogleAdMob-SDK into one. You will use that file (instead of blue project file) to open your project from now on. If your project is already open in Xcode then opening this may give you some error (YourProject is already open in Xcode). So you have to close your project first and then open this Project Workspace file.
  • How to Add Admob in iOS app

Adding Banner View

  • 1. After you have opened your Project Workspace, open you storyboard file (cmd + shift + O and type your storyboard filename).
  • 2. Drag and drop a generic View from Object Library. We will call it AdMob BG. Set its height to 50px which is equal to the height of banner ad. Set its background to black. Position it where you want it to. Add necessary layout constraints.
  • 3. Add another view, AdMob Container and it will hold the actual ad. Set its width to 320px and height to 50px as banner ad is 320 x 50px. Add necessary layout constraints. No open identity inspector (cmd + opt + 3) and set its class field to GADBannerView. Fig 4. Remember to select AdMob Container before doing this.
  • admob4
  • 4. So far so good. You have to create a connection of AdMob Container view to the code file. Press option + command + 0 to open assistant editor and open header file (ends with .h) for that view controller. We have to insert following import statements before @interface ViewControllerClassName : UIViewController line.
    #import "GADBannerView.h"
    #import "GADRequest.h"
  • 5. Now for creating the connection click Admob Container in the document outline and ctrl + drag your cursor into he header file between @interface ViewControllerClassName : UIViewController and @end. Fig 5.
  • How to Add Admob in iOS app
  • Doing this will open a popup which will ask for name of connection. (Fig 6) lets call it bannerView. Hitting enter will add a new line for IBAction connection (Fig 7). Notice the circle on the start of that line. That indicates that the connection is working. An empty circle means there is something wrong with the connection.
  • How to Add Admob in iOS app
  • How to Add Admob in iOS app
  • 7. Note: In all these screens the header file we imported in #Step 4 is missing.
  • 8. Now its time to code. Open your view controller implementation file (hit option + cmd + 0, to open file in assistant view and select the .m file from) and in the viewDidLoad function after call to [super viewDidLoad] write the following code.
  • _bannerView.adUnitID = @"ca-app-pub-4987788162507876/7045971044"; 
    _bannerView.rootViewController = self; 
    GADRequest *request = [GADRequest request]; 
    request.testDevices = @[GAD_SIMULATOR_ID]; 
    [_bannerView loadRequest:request];
  • 9. The first line sets adUnitID which you get from your Google AdMob account by creating a new app. The code pasted here will always open test ads and is just for demonstration purposes. _bannerView is the name we entered while making connection (Step 5). Precede it with underscore.
  • 10. We are all good now. Hit cmd + R to run the app. You’ll see a output similar to Fig 1.

Whats next

This is just the basics. We will update this guide soon with following content.

  • 1. Interstitial or Fullscreen Ads.
  • 2. Adaptive Ads for iPad and iPhone.
  • 3. Removing AdMob in existing project.
xcode

How to setup Xcode

Requirements

1. Mac System: Mac Mini, iMac, Macbook pro or Mac pro

Install Xcode

  • 1. Goto App Store. Search for Xcode and install Xcode from there. Its heavy in size so it will take some time to download and install it. This guide is written with Xcode 6.1.
  • 2. Install Xcode’s command line tools by typing following command into the Terminal. code-select —install A dialog will appear asking you to install the command line tools. Click Install. This is an optional step and most of the apps compile fine without Xcode tools also but install it anyway to avoid any unexpected issues.
  • 3. If you have already installed Xcode then you should update it. All softwares are built on latest Xcode and latest Xcode ensure that your app is error free and works smoothly on latest iOS. To update goto App Store. Search for Xcode and if click install button. If it doesn’t show install option then go to Updates section of Xcode and install any updates related to Xcode.

Install Cocoapods

Cocoapods is a dependancy manager for iOS (http://cocoapods.org/). All of our recent projects use
cocoapods.

  • 1. Type the following command in Terminal to install Cocoapods. sudo gem install cocoapods It will prompt you for your system password. Typing password wont show any characters for security purposes. Type your password and hit enter.
  • Test your setup

  • 1. Download our test project at Github by typing following commands in Terminal. git clone https://github.com/mobilemerit/DemoXcode.git cd DemoXcode pod install
  • 2. This will take some time and all the project dependancies will be updated.
  • 3. Goto project folder and double click DemoXcode.xcworkspace. It will open in Xcode.
  • 4. Run the project by pressing run button or hitting cmd + R.
  • 5. iPhone Simulator will open and print s a text message (Fig 1).
  • 6. If the Run button is greyed out then wrong scheme is selected. You have to create a new scheme. Click “New Scheme” by opening the scheme dropdown (Fig 1). A dialog will appear. Click OK (Fig 2).
  • 7. When you’re done click stop button next to run button on top left or hit cmd + .
  • How to setup Xcode

    How to setup Xcode

    Testing in more environments

    By default only few simulators are available but you can install more by going to Xcode >
    Preferences > Downloads. Simulators are listed under components section. Click the small circular
    grey button on the right of simulator name.

    After that more options will be available in devices dropdown.

mobile_app

Mobile App Development Resources

If you are planning to start mobile app development, check out the links below. They are a collection of resources that you may need for iPhone app, Android App, Microsoft mobile app or HTML5 based app development.

Apple iOS, iPhone App development

iOS Development Center

https://developer.apple.com/devcenter/ios/index.action

Resources for Apple Developers

https://developer.apple.com/resources/

Getting started Tutorial

https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/index.html

Register as an Apple Developer

https://developer.apple.com/register/index.action

Xcode 6 – Toolset for building Apps

https://developer.apple.com/xcode/

iOS 7 SDK

https://developer.apple.com/ios7/

Swift is an innovative new programming language

https://developer.apple.com/swift/

iTunes – Apple Marketplace

http://www.apple.com/itunes/

Android App development

Official site provides information for users and developers

http://www.android.com/

Google Play Store

https://play.google.com/store

Provides documentation for App developer

http://developer.android.com/

Latest news and Android updates

https://plus.google.com/+android/posts

Download Android SDK

http://developer.android.com/sdk/index.html

Microsoft App development

Windows mobile development centre

http://msdn.microsoft.com/en-in/windowsmobile/bb264318.aspx

Getting Started with Windows Mobile Application Development

http://msdn.microsoft.com/en-in/windowsmobile/bb250560.aspx

Windows Mobile 6 SDK

http://www.microsoft.com/en-us/download/details.aspx?id=6135

Windows marketplace for Mobile

http://www.windowsphone.com/en-US/store

Get info on Windows Phones

http://www.windowsphone.com/en-us

Development Tools and Resources for Windows Mobile

http://msdn.microsoft.com/en-us/library/bb158509.aspx

Windows Phone Development Centre

https://dev.windowsphone.com/en-us

Top Mobile Frameworks:

Sencha Touch

JQuery Mobile

http://jquerymobile.com/

Ionic and AngularJS

http://ionicframework.com/

Kendo UI

http://www.telerik.com/

Appcelerator Titanium

http://www.appcelerator.com/

To add your link or for any other feedback, pl. Contact us.