• Skip to main content
  • Skip to primary sidebar

Ravi Shankar

Tweaking Apps

  • Swift
  • Tech Tips

iphone

iPhone is not available error message in Xcode

September 8, 2020 By Ravi Shankar

If you are receiving an error “iPhone is not available” when connecting Xcode with iPhone then check iOS version on your iPhone. Make sure it is compatible with the Xcode version.

iPhone is not available

The conflict in versions can be found under the Xcode – Window – Devices and Simulators. In my case the following error was mentioned.

Errors

“The current device configuration is unsupported. This iPhone 7 (Model 1660, 1778, 1779, 1780) is running iOS 13.6.1 (17G80), which is not supported by Xcode 11.7”

The fix was to upgrade iOS on my iPhone to iOS 13.7.

Filed Under: Xcode Tagged With: iphone

Protect WhatsApp with Touch ID in iPhone

February 17, 2019 By Ravi Shankar Leave a Comment

Now you can lock WhatsApp on your iPhone with Touch ID. If your phone is being accessed by family memebers then this would be quite helpful to prevent other users from accessing your WhatsApp message.

Steps to enable Touch ID for WhatsApp

  1. Tap Settings on your WhatsApp app.

  2. In the Setting screen, navigate to Privacy option.

  3. Scrolled down the Privacy screen and select Screen Lock from the list.

  4. Now this will have the option to enable or disable Touch ID for WhatsApp. This also provides option to set the time of lock to appear whether immediately or after certain time.

Filed Under: iPhone, WhatsApp Tagged With: iphone, TouchID, WhatsApp

Simple UITableView and UIAlertView example

January 9, 2014 By Ravi Shankar 1 Comment

In this article, we are going to see how to create a simple UITableView for displaying data. And display an alert on selection of any row using UIAlertView.

Launch Xcode, Click File > New Project and select Single View Application as the project template.

Choose a template for new new project

Enter the project details for Product Name, Organization Name, Company Identifier and Target device as iPhone.

201401091129.jpg

Then choose a location on your Mac to save the project.

201401091131.jpg

Navigate to Main.Storyboard and and delete the ViewController under View Controller Scene. Since we want a TableView, we are going to replace this View Controller with UITableViewController.

201401091134.jpg

Note :- We could have also used UITableView on top of View Controller but we will keep that for another session.

Now select UITableViewController from the Object library, drag and drop it on to the User Interface.

201401091141.jpg

Let us see the how to display list of values in the above table.

Navigate to ViewController.h in the Project Navigator and replace the following line

@interface ViewController : UIViewController

with

@interface ViewController : UITableViewController

Then use the Identity Inspector and specify the class for TableViewController as ViewController.

201401091146.jpg

Edit ViewController.m file and add a new instance variable and populate the cities in ViewDidLoad method.

@implementation ViewController

{

NSArray *cities;

}

– (void)viewDidLoad

{

[super viewDidLoad];

  

//Create the list of cities that will be displayed in the tableview

  

cities = [[NSArray alloc] initWithObjects:@”Chennai”,@”Mumbai”,@”New Delhi”, @”New York”, @”London”,@”Tokyo”,@”Stockholm”,@”Copenhagen”,@”Manchester”,@”Paris”,nil];

}

In the above code, cities is of type NSArray and it is initialised with set of values in the ViewDIdLoad method. These values will be displayed in the UITableView.

The ViewController will act as a delegate and datasource for the UITableViewController. These connections are automatically created and you can verify them by right clicking on the ViewController. If we had used UITableView instead of UITableViewController then these connections have to be made manually.

201401091202.jpg

The data for the tableview is provided by the following methods and these methods needs to be implemented in ViewController.m.

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

numberOfRowsInSection method is used for specifying the total rows in each section for the tableview. In this example, the UITableView has only one section for displaying the cities.

cellForRowAtIndexPath method is used for providing the data to each row in the TableView. The data is populated using the indexPath for each row.

Copy the method implementation to ViewController.m file

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{

return [cities count];

}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@”Cities”];

  

cell.textLabel.text = [cities objectAtIndex:indexPath.row];

  

return cell;

}

The numberOfRowsInSection provides the tableview with the total count of rows i.e number of items in the cities array object. In the cellForRowAtIndexPath, we create a reusable UITableViewCell and assign the cities as per the row indexPath. Also make sure to specify the Identifier for prototype cell (User Interface) as Cities using the Attributes Inspector.

Now if you build and run the project, you should see a table with list of cities as shown below.

201401091307.jpg

Display the row selection using UIAlertView

Nothing will happen when you select any of the rows in the above table. Let us use the UIAlertView to display the row selection and for this we need to implement didSelectRowAtIndexPath in ViewController.m. Add the following didSelectRowAtIndexPath method implementation to the file.

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

NSString *cityName = [cities objectAtIndex:indexPath.row];

  

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@”City” message:cityName delegate:self cancelButtonTitle:@”Cancel” otherButtonTitles:nil, nil];

  

[alertView show];

}

The above code first retrieves the city name from cities array object using the row’s indexPath. In the second line, we create a instance of UIAlertView with title as “City”, selected city for the message attribute and provide the title for the cancel button. The delegate for UIAlertView will be ViewController and this specified by the delegate attribute. In the last line we use the show method to display the alert.

UITableView showing UIAlertView

Download the source code from here.

Filed Under: Develop, ios, iPhone, Programming, Xcode Tagged With: iOS, iphone, UIAlertView, UITableView, Xcode

How to change bluetooth device name of iPhone/iPad/Mac

October 23, 2013 By Ravi Shankar Leave a Comment

Change bluetooth name for iPhone, iPad and Macbook Pro.

In this tutorial we are going to cover the steps required to change the device name that appears while discovering bluetooth enabled Apple devices. For example when you are trying to pair iPhone with MacBookPro, the Set up Bluetooth Device screen on Macbook Pro would display the following

Bluetooth Set up Wizard

Where “Ravi Shankar’s iPhone” is the name of my iPhone. Similarly on iPhone under Bluetooth settings, you should find the MacBook Pro’s name.

Bluetooth Paired device name on iPhone

How to change bluetooth device name for iPhone

Step 1: Tap the Settings icon on the Home screen.

Step 2: Under Settings, Tap General options.

General Settings on iPhone

Step 3: Navigate to About option under General Settings.

General Settings on iPhone

Step 4: In the About screen Tap Name option. This should provide an option to change the name of your iPhone.

201310231603.jpg   Change name on iPhone  

How to change bluetooth device name for iPad

Follow the same steps mentioned for iPhone (Step 1 to 4) to reach the Name screen on your iPad.

Change iPad bluetooth name

How to change bluetooth name for Macbook Pro

Step 1: Click the Apple icon and select System Preferences from the menu list

System Preferences on Macbook Pro

Step 2: In System Preferences screen, navigate to Internet & Wireless section and click Sharing option.

Sharing option on Mackbook Pro

Step 3: Click Edit button under Computer Name section and provide your preferred name.

Computer name on Macbook Pro

Change bluetooth computer name on Macbook Pro

Step 4: Click OK button to confirm and save the changes.

Also See:

1. Turn On/Off bluetooth on iPad

2. Rename bluetooth devices on Macbook Pro

3. What is Control Center in iOS 7

Filed Under: Apple, iPad, iPhone, Mac, Mac OS X Tagged With: Apple, Bluetooth, device name, iPad, iphone, Mac

Create an example iOS Project using Xcode

June 26, 2013 By Ravi Shankar Leave a Comment

We had already covered the basic overview of Xcode and now we are going see the steps required for creating an sample iOS Project that displays Welcome message on Xcode simulator.

Topics Covered

  1. Create New Project using Xcode.
  2. Add label control to Interface Builder.
  3. Edit label to add Welcome message
  4. Choose simulator in Xcode.
  5. Compile, Build and Run the project in Xcode.

Step 1: Launch Xcode then click FIle -> New -> Project.

201306251050.jpg

Step 2: In the Choose a template for your new project, pick Single View Application under the IOS section and click the Next button.

201306251052.jpg

Note :- We will cover the different templates in detail in future tutorials.

Step 3: Now in Choose options for your new project, enter the name for your project, organisation name and company identifier. In the Devices drop down select iPhone and mark the check box with caption as “Use Storyboards” and “Use Automatic Reference Counting” and click Next button.

201306251100.jpg

Some of the above terms like Storyboards, Automatic Reference Counting will be covered in future tutorials.

Step 4: Specify the location for creating this project and click the Create button.

201306251110.jpg  

Now a new project should be created and you should see a screen as shown below.

201306251115.jpg

Step 5: Select the MainStoryboard.storyboard in the Navigator Pane to access the Interface Builder.

201306251120.jpg

Step 6: Navigate to Utilities section and click Object tab. Scroll down and pick label control from the list then drag and drop the label on to Interface Builder.

201306251123.jpg

201306251123.jpg

Step 7: Edit the label and enter Welcome text.

201306251125.jpg

Step 8: Now select the iPhone simulator under Scheme section in Xcode toolbar.

201306251129.jpg

Step 8: Select Run option on Xcode toolbar or use the keyboard combination of command + R to run the sample project on Xcode simulator for iPhone. command + R will first compile and build the project before launching it on the simulator.

Filed Under: Apple, Develop, iPhone, Xcode Tagged With: Apple, iphone, Xcode

Auto arrange Home screen icons on iPhone or iPad

April 9, 2013 By Ravi Shankar 1 Comment

This is a short tip on the steps required to auto arrange your apps on iPhone and iPad Home screen. This is useful when you have removed lot of unwanted apps on your device’s home screen and manually re-arranging the icons will be nightmare.

imageimage

Step 1: Access iPad or iPhone home screen and tap the Settings icon.

image

Step 2: In the Settings screen, navigate to General Options.

imageimage

Step 3: Scroll down and tap the Reset option under General Settings.

imageimage

Step 4: In the Reset screen. tap the Reset Home Screen Layout option. Then confirm your action by tapping the Reset Home Screen button. This should do the trick and will auto arrange all your apps on the Home screen.

Filed Under: iPad, iPhone Tagged With: apps, Autoarrange, Home Screen, Icons, iPad, iphone, Reset Home Screen

Different data types in Objective-C

March 3, 2013 By Ravi Shankar Leave a Comment

Objective-C like any other programming languages has different data types like int, float, double, char and id. Data types are used for specifying the kind of data that is being stored in a variable. For example, the below code stores a single character to a variable “flag”

char flag = ‘1’

201303031336.jpg

Data type – char

The Objective-C Char data type can store single character of letter or number or special characters. This is done by enclosing the character with in single quotes.

var example1 = ‘W’ (store letter)   

var example2 = ‘3’ (store number)

var example3 = ‘:’ (store special character)

var example4 = ‘/n’ (backlash character is a special character)

Data type – int

int data type is used for storing positive or negative whole numbers. The range of values that can stored depends on the 32 bit or 64 bit operating system.

int count = 10

int exoctal = 036

int hex = 0xADD2

in the above example 0 preceding the number represents octal value and hex number is preceded with 0x

Date type – float & double

float is used for storing positive or negative decimal numbers.

float exfloat = 2.45

float exfloat2 = -0.345

float exfloat3 = 1.2e4

As shown in the last example, float data type can be represented in scientific notation 1.2e4 which is equivalent 1.2x10th power of 4.

double data type can store twice the range of float.

Data type – BOOL

BOOL is used for storing YES or NO i.e 1 or 0

BOOL flag = 1

Data type – id

id data type is used for storing object of any type.

id myfirstObject

Qualifiers

Qualifiers in Cbjective-C are used for increasing range of the data type and the range is system dependant. Qualifiers are placed just before the data type as shown below. The different qualifiers are long, long long, short, signed and unsigned.

Filed Under: Apple, Develop, iPhone, Programming Tagged With: Apple, data type, iphone, Objective C

XCode’s iOS Simulator for iPhone and iPad

March 2, 2013 By Ravi Shankar Leave a Comment

iOS Simulator in Xcode can be used for testing iOS apps before trying the apps on a live device. Listed below are the different settings and features on iOS Simulator.

Launching iOS Simulator

iOS Simulator can be launched by executing Program on Xcode

Run Program on Xcode : Keyboard Shortcut is Command + R, Menu is Product -> Run

The screenshot of IOS Simulator is shown below.

201303021038.jpg

Another alternate way to launch the iOS Simulator is by using the menu option under

Xcode -> Open Developer Tool -> IOS Simulator

201303021039.jpg

iOS SDK Version

IOS SDK version of iOS Simulator can be determined by clicking the Hardware menu -> Version

201303021112.jpg

Deleting Apps and Settings

Reset Content and Settings option clears all the apps and settings from the simulator. For example if you have changed the app icon, the new icon will not be displayed unless you delete the app from the simulator and re-run the program.

201303021133.jpg

You can also delete individual apps by clicking and holding the installed apps followed by clicking delete mark just like you do on any iOS device.

201303021135.jpg

Choosing the device screen on Simulator

IOS Simulator allows users to choose different device screens such as iPad, iPad (Retina), iPhone, iPhone (Retina 3.5 inch) and iPhone (Retina 4 inch). You can choose the desired screen by navigating to Hardware menu option and selecting the Device.

201303021206.jpg

It is always recommend to try out the apps on the different device simulator before releasing it on the App Store. For example if you are developing an app for the iPhone then you need to try out in all the 4 iPhone device simulator apart from testing your app on live device.

Taking App Screenshots using Simulator

IOS Simulator can be used for taking screenshots of your app for publishing app on the App Store. This is quite useful when you do not have all IOS devices but still want to see the screenshots of your app. The Screenshots can be taken by loading the app on the Simulator and clicking the File menu -> Save Screenshot. The screenshot will be saved to your desktop in .PNG file format.

201303021146.jpg

IOS Simulator also provides option to copy the individual screen from the simulator using the option available as part of the Edit menu.

201303021200.jpg

Other Hardware features

IOS Simulator has features that lets users to see the behaviour of the app on each action such as Rotating Screen to Left, Rotating the Screen to Right, Shake Gesture, Accessing the Home Screen, Locking the Device and also simulating low memory warning.

201303021214.jpg

Simulate Locations

Location menu option under the Debug menu is quite useful for development of location based apps. This lets developers to simulate location required for testing their app.

201303021218.jpg

iOS Simulator Screen Zooming

IOS Simulator screen size can be increased and decreased based on your need using Window -> Scale menu option.

201303021222.jpg

Filed Under: Apple, Develop, ios, iPad, iPhone, Xcode Tagged With: Apple, iOS Simulator, iphone

  1. Pages:
  2. 1
  3. 2
  4. »
Next Page »

Primary Sidebar

TwitterLinkedin

Recent Posts

  • How to block keywords in Jio broadband
  • How to disable opening an app automatically at login in Mac
  • How to set preferred Wifi network on Mac
  • Attribute Unavailable: Estimated section warning before iOS 11.0
  • How to recover Firefox password from Time Machine backup

Pages

  • About
  • Privacy Policy
  • Terms and Conditions

Copyright 2022 © rshankar.com

Terms and Conditions - Privacy Policy