iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

osx – How to programmatically delete a file with elevated privileges?

I’m trying to remove a file form the ~/Library/PreferencePanes folder, and this cannot be done with normal privileges. Usually, if you need to delete any file from the ~/Library folder the system will ask for your username and password. The current way I do this is with [[NSFileManager defaultManager] removeItemAtPath:filePath error:&error] but this keeps on […]

How to get the other devices' host name in the same wifi?

I found some iOS app which could scan the local network and list all the device information. I wonder how. Pic:

iPhone dev – create array in init or viewDidLoad

In my UIViewController subclass should I initialize the NSArray of data for the UIPickerView in init or in viewDidLoad and why? Thanks.

Objective-C SSL Synchronous Connection

I’m a little new to objective-C but have run across a problem that I can’t solve, mostly because I’m not sure I am implementing the solution correctly. I am trying to connect using a Synchronous Connection to a https site with a self-signed certificate. I am getting the Error Domain=NSURLErrorDomain Code=-1202 “untrusted server certificate” Error […]

Remove Gray UITableView Index Bar

I am making an application with a UITableView that has a few sections (2), and when I run, the table view has this annoying gray index bar on the side, like the one in the “iPod” application, that has but 2 options in it. My question is, how do I hide the “index bar,” because […]

Number of characters in a string (not number of bytes)

In a string in objective-c if I say something like [myStr length]; it returns a number which is the number of bytes but what can I use to return the number of characters in a string. For example: a string with the letter “a” in it returns a length of 1 a string with a […]

how to apply check mark on table view in iphone using objective c?

i m trying for apply for check mark in table view, but it is not working, if i checked again at that cell again then check mark apply. but not apply at new selected cell. any one there who help me…. thanks aamir. i m using following code #pragma mark – #pragma mark Table Data […]

Rounding with significant digits

In Xcode /Objective-C for the iPhone. I have a float with the value 0.00004876544. How would I get it to display to two decimal places after the first significant number? For example, 0.00004876544 would read 0.000049.

Unable to add a custom font in Mac app (OSX 10.9+ Xcode5+)

I have gone through these SO posts: Embed font in a mac bundle Custom font in a Cocoa application I tried exactly same (rechecked multiple times), but I am not able to add a custom font to my Mac App. All details are shown in attached pictures. Plist is updated: (Tried Fonts and Fonts/ both) […]

Attempt to present UIAlertController on UIViewController whose view is not in the window hierarchy

I’m trying to check the UIAlertController in iOS 9 for my sample application and while run it then I had found warning in console. I’m using Xcode 7 and Objective C. Please find the below warning message in console. Warning: Attempt to present < UIAlertController: 0x7fb1bb5be040 > on < ViewController: 0x7fb1bb5aef30 > whose view is […]