Tag: c

Will my iPhone app take a performance hit if I use Objective-C for low level code?

When programming a CPU intensive or GPU intensive application on the iPhone or other portable hardware, you have to make wise algorithmic decisions to make your code fast. But even great algorithm choices can be slow if the language you’re using performs more poorly than another. Is there any hard data comparing Objective-C to C++, […]

Learn C first before learning Objective-C

Being an aspiring Apple developer, I want to get the opinions of the community if it is better to learn C first before moving into Objective-C and ultimately the Cocoa Framework? My gut says learn C, which will give me a good foundation.

How can I use commercial at sign in Objective-C macro?

How can I use commercial at sign in Objective-C macro? I know it is not recommended, but seems it is possible somehow? Since libextobjc provides @weakify, @strongify, etc…

How to incorporate WebSockets into a Cocoa application

I am developing a Cocoa application which involves a chat element. One approach I’ve considered is using Websockets to handle client-server communication. This would be particularly desirable because chats will also be displayed on a website, and using Websockets could make the implementation very simple. So: would it be possible to use a WebView element, […]

Comparing float and double data types in objective C

When using double or float data type in an iPhone app, I am running into problems with “>=” and “<=” comparisons because when a variable is assigned a number entered with one decimal place, such as 4.2, the float or double used in the comparison actually may have a value such as 4.1999998092651367. Because of […]

3 questions about extern used in an Objective-C project

When I use the word extern before a method or variable declaration, am I making it global and therefore readable/writable/usable over the entire project ? If I use extern before a keyword, is there any chance it is still not accessible by part of my project ? For example, only by subclasses.. such as when […]

Check if object is Class type

I have a method that receives a NSArray of Class objects and I need to check if they all are Class type generated with the code bellow: NSMutableArray *arr = [[NSMutableArray alloc] init]; [arr addObject:[NSObject class]]; [arr addObject:[NSValue class]]; [arr addObject:[NSNumber class]]; [arr addObject:[NSPredicate class]]; [arr addObject:@”not a class object”]; The problem is that Class […]

What is double star (eg. NSError **)?

So, I saw this: error:(NSError **)error in the apple doc‘s. Why two stars? What is the significance?

How to decide between MonoTouch and Objective-C?

After sitting through a session today on Mono at a local .Net event, the use of MonoTouch was ‘touched’ upon as an alternative for iPhone development. Being very comfortable in C# and .Net, it seems like an appealing option, despite some of the quirkiness of the Mono stack. However, since MonoTouch costs $400, I’m somewhat […]

Why write 1,000,000,000 as 1000*1000*1000 in C?

In code created by Apple, there is this line: CMTimeMakeWithSeconds( newDurationSeconds, 1000*1000*1000 ) Is there any reason to express 1,000,000,000 as 1000*1000*1000? Why not 1000^3 for that matter?