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

Why aren't objects of type 'id' initialized as pointers with a '*' in Objective-C?

If I’m using Objective-C, here’s how I declare an initialize an int: int a = 1; vs an object: myObj *a = [[myObj alloc] init]; So this is a pointer to an object as denoted by the ‘*’. My question is, why aren’t objects of type id declared this way? I.e., why is it this: […]

Case insensitive indexOfObject for NSArray

Is there an easy way to do a case insensitive lookup in an NSArray of NSStrings? Reference for NSArray mentions sorting case insensitively but nothing about lookup. I can easily write my own fn to do it but would like to know if there’s an easier way.

NSJSONSerialization for an object with an id attribute

So I’m trying to do a GET request that returns some Json. The json that gets returned from this request has an id attribute, so the class that I use NSJSONSerialization to parse the json should have an id attribute. Since id is reserved in objective-c, I can’t include it as an attribute in my […]

How to show the title on my Pin Annotation and make it clickable to perform some action?

In my MapView i have pin dropped on certain locations and now i want to display some title on these pin annotation and make it clickable so that on click i can push another view. Please help !!!!

Is it possible to retrieve the create time of the iPhone contacts record?

I want to ask a question about iPhone. Is it possible to retrieve the creation time from the iPhone contacts of each record? Thank you.

how to cast response object to an object

[manager POST:urlString parameters:[self jsonDict] success:^(AFHTTPRequestOperation *operation, id responseObject){ NSLog(@”response data: %@”, responseObject); NSArray *postFromResponse = [ responseObject valueForKeyPath:@”credentials”]; NSLog(@”credentials:%@”, postFromResponse); for(NSDictionary *object in postFromResponse) { NSString *AccessKeyId = [object valueForKeyPath:@”AccessKeyId”]; NSLog(@”%@”, AccessKeyId); } } It gives me error: Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: ‘[<__NSCFString 0x79ea4430> valueForUndefinedKey:]: this class is not key value […]

Where is build output going?

I have a library project in Xcode 4. I’m building against iOS 4.3. The build products path is set to /Developer/Projects/BuildOutput. I’m building ‘iPhone 4.3 Simulator’. In Xcode4, how do you specify a debug or release build? When I go to /Developer/Projects/BuildOutput/Debug-iphonesimulator, the library .a file is not there. In the project settings Info tab, […]

Setting file permissions in Objective-C

I managed to get my hands on a nifty ftp object. It is very low level and easy to adapt. I’m using it to transfer files from one Mac to another via FTP. Now, the issue I’m having is that when the file, that is transfered, reaches its destination, the other Mac, the access permissions […]

Cannot add object to NS array

I have an array of restaurants defined in the header file @property (nonatomic, strong) NSMutableArray *resPool; //pool of restaurants Now I am trying to add a restaurant object to this array by doing the following in the .m file: id restaurant = [[Restaurant alloc] initWithResName:resName] [self.resPool addObject:restaurant];// add the restaurant to the res pool array […]

Adding dynamic sub-rows by selecting tableview row in tableview iPhone errors?

I want to add row dynamically. I have tableview list of building names. If some one choose building(didSelectRowAtIndexPath) then respective floors of building should get added dynamically as subrow. Its like maximizing and minimizing the subrow on respective building list selection. How do I do this. Thanks in advance… – (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // There […]