Skip to main content
1412 votes
39 answers
517k views

How can I check for an active Internet connection on iOS or macOS?

I would like to check to see if I have an Internet connection on iOS using the Cocoa Touch libraries or on macOS using the Cocoa libraries. I came up with a way to do this using an NSURL. The way I ...
Brock Woolf's user avatar
  • 47.3k
1331 votes
82 answers
1.0m views

Xcode - How to fix 'NSUnknownKeyException', Reason: "… this class is not key value coding-compliant for the key X" error?

I'm trying to link a UILabel with an IBOutlet created in my class. My application is crashing with the following error" *** Terminating app due to uncaught exception 'NSUnknownKeyException', ...
1048 votes
14 answers
449k views

Constants in Objective-C

I'm developing a Cocoa application, and I'm using constant NSStrings as ways to store key names for my preferences. I understand this is a good idea because it allows easy changing of keys if ...
Allyn's user avatar
  • 20.4k
776 votes
20 answers
387k views

How do I create delegates in Objective-C?

I know how delegates work, and I know how I can use them. But how do I create them?
Andy Jacobs's user avatar
  • 15.2k
729 votes
10 answers
270k views

Cocoa Autolayout: content hugging vs content compression resistance priority

I can't find a clear answer on Apple documentation regarding Cocoa Autolayout about the difference between content hugging and compression resistance. Can somebody explain their usages and ...
dmitrynikolaev's user avatar
718 votes
16 answers
172k views

@class vs. #import

It is to my understanding that one should use a forward-class declaration in the event ClassA needs to include a ClassB header, and ClassB needs to include a ClassA header to avoid any circular ...
Coocoo4Cocoa's user avatar
  • 50.6k
660 votes
9 answers
181k views

What does the NS prefix mean?

Many classes in Cocoa/Cocoa Touch have the NS prefix. What does it mean?
Martin08's user avatar
  • 21.4k
634 votes
14 answers
231k views

Cocoa: What's the difference between the frame and the bounds?

UIView and its subclasses all have the properties frame and bounds. What's the difference?
mk12's user avatar
  • 26.3k
572 votes
8 answers
166k views

@synthesize vs @dynamic, what are the differences?

What are the differences between implementing a @property with @dynamic or @synthesize?
nico's user avatar
  • 9,716
452 votes
13 answers
147k views

How to print out the method name and line number and conditionally disable NSLog?

I'm doing a presentation on debugging in Xcode and would like to get more information on using NSLog efficiently. In particular, I have two questions: is there a way to easily NSLog the current ...
rein's user avatar
  • 33.5k
427 votes
13 answers
147k views

throwing an exception in objective-c/cocoa

What's the best way to throw an exception in objective-c/cocoa?
Steph Thirion's user avatar
418 votes
9 answers
109k views

Is It Possible to NSLog C Structs (Like CGRect or CGPoint)?

I want to be able to debug C structures without having to explicitly type every property that they consist of. i.e. I want to be able to do something like this: CGPoint cgPoint = CGPointMake(0,0); ...
mazniak's user avatar
  • 5,879
394 votes
9 answers
209k views

How do I convert NSMutableArray to NSArray?

How do I convert NSMutableArray to NSArray in objective-c?
marcy's user avatar
  • 4,223
363 votes
25 answers
51k views

Exception thrown in NSOrderedSet generated accessors

On my Lion app, I have this data model: The relationship subitems inside Item is ordered. Xcode 4.1 (build 4B110) has created for me the file Item.h, Item.m, SubItem.h and SubItem.h. Here is the ...
Dev's user avatar
  • 7,046
363 votes
12 answers
190k views

Best way to define private methods for a class in Objective-C

I just started programming Objective-C and, having a background in Java, wonder how people writing Objective-C programs deal with private methods. I understand there may be several conventions and ...

15 30 50 per page
1
2 3 4 5
2643