Objective-c is a highly dynamic message-based object-oriented language, superset of C, that is a primarily used for programming Apple's Mac OS X and iOS platforms.

learn more… | top users | synonyms

0
votes
2answers
156 views

Why can't I use an operator like plus sign to concatenate strings? [closed]

Why in Objective-C we should be typing explicit references to methods like stringByAppendingString to concatenate strings, when in some other languages we can use operators for that? For example, ...
3
votes
1answer
143 views

Is Apple sample code the “correct” way to go?

I'm in a place were I know how to build apps and have submitted at least 5 for different clients to the app store and wanted to step up my game. So of course I went to Apple resources and analyse the ...
0
votes
1answer
82 views

Do iOS frameworks require the same internal versioning as OSX frameworks?

I have been reading through the apple documentation for creating frameworks for OSX and iOS. Reading about the structure of frameworks, I began to wonder if there is really any need to create the ...
1
vote
1answer
184 views

Manage the persistence of entities on iOS in several places: CoreData on the device, iCloud and on a REST API

For the needs of a project, I would persist the datas contained in Core Data in several places depending on the state of the user. If the user is logged to my API -> Persist the datas on my API. ...
5
votes
1answer
169 views

Why check if object is nil

What's the point of the if statement in the following code: - (NSArray *)myMethod { NSArray *array = nil; if (!array) { array = [[NSArray alloc] initWithObjects...] } return ...
0
votes
0answers
13 views

Abstracting AutoLayout sensibly - why is this so conceptually tough and where should I begin?

Below are some babbling, probably incoherent thoughts, but I am so stuck on this problem and I feel like an elegant solution is possible. Though it is indisputably awesome, and makes programatic view ...
-4
votes
1answer
57 views

Help with lengthening code [closed]

I have a line of code in shouldChangeCharactersInRange. I want to how I can break down this code. return ([[string stringByTrimmingCharactersInSet:characterSet] length] > 0); What I want to do ...
2
votes
2answers
155 views

Example of writing unit test for a method

I am writing unit tests for an iOS application. I clearly understand the benefits of writing unit tests & TDD, but I am confused about what kind of tests you can write for methods like this; ...
0
votes
1answer
86 views

Is Objective-C the only language with infix arguments?

One of the things I like about Objective-C is the use of infix arguments when calling a method. [myDictionary setObject:myObject forKey:@"key"]; where the method name is setObject:forKey:. Does any ...
-3
votes
1answer
64 views

Will adding Swift to my Objective-C project slow down my app or IDE?

I have been working on an iOS app in Objective-C for a few months now, and I'd like to try out Swift. Both languages can be used alongside each other via a briding header. Right now my project is ...
3
votes
3answers
357 views

In Objective C, what English words can I conceptually associate to the symbols?

I'm learning Objective C (from a C# background) and am having difficulty understanding the unusual method signatures and am looking for a shortcut to make the learning curve less steep. When reading ...
1
vote
1answer
80 views

Objective-c anonymous property coding style

If I have an interface defined like @interface MyClass @property (nonatomic, copy, readonly) NSString *myString; @end so that myString is externally visible but can't be written, what would be ...
3
votes
6answers
2k views

What are the Most Important things to know about iPhone Development? [closed]

For example I just learned today about NARC. Never release something unless you made it "New, Alloced, Initialized or Copied". That just fixed a couple different bugs in my app that I couldn't find. ...
12
votes
1answer
511 views

Naming convention for iOS/OSX open-source projects

Not always but most of the time, you will find iOS or Mac OS X open-source projects with names starting with the initial letters of the author first and last names. If a project were to be authored by ...
0
votes
1answer
307 views

How static functions are better than Class Methods in Objective-C [closed]

I was going to through this post by Mattt Thompson in which he mentions that Static functions are nicer than shoe-horned class methods I just don't see any flaw with Class methods in ...
5
votes
1answer
269 views

How do you write tests for methods that interact with data in system files?

I'm trying to be proactive about writing an iOS app in a test-driven manner. However, I'm stumped as to how to test a method that is to interact with real system files. For those familiar with iOS, ...
-2
votes
1answer
117 views

How come the keyword for declaring a class is 'interface' [closed]

What is the relationship between a class and an interface in objective-c? How come we declare a class using @interface instead of @class?
9
votes
2answers
658 views

Massive View Controller - IOS - Solutions

I'm sure every new iOS developer has the following problem: The View Controllers get very fast crowded with code for various purposes, easily getting to 500 + lines of code. This is how it looks like ...
1
vote
1answer
198 views

Does key-value observing between model and view violate MVC?

In MVC the Controller is the go-between for the View and the Model. So the Controller should be the one that observes or receives changes from the Model and View and updates the other accordingly. I ...
91
votes
5answers
38k views

How can Swift be so much faster than Objective-C in these comparisons?

Apple launched its new programming language Swift at WWDC14. In the presentation, they made some performance comparisons between Objective-C and Python. The following is a picture of one of their ...
2
votes
1answer
259 views

Performance of Class methods vs singleton instance methods

In my app, I'm using both strategies: I have a Utils class, it only has class methods that I call for doing common global methods, like NSString validation, etc. I have an app-wide singleton class ...
4
votes
2answers
441 views

What is the most appropriate testing method in this scenario?

I'm writing some Objective-C apps (for OS X/iOS) and I'm currently implementing a service to be shared across them. The service is intended to be fairly self-contained. For the current functionality ...
2
votes
1answer
441 views

Inheritance, Composition and Protocols

I'm reading a book on general object oriented concepts to try and gain a solid understanding of everything. One thing that is throwing me off is the difference between Inheritance and Composition. I ...
25
votes
3answers
1k views

Is it considered a bad practice to add logic in a property setter?

I jumped in to a project and I see that the other developers are adding a lot of logic in the setters of synthesized properties. I understand how this works, but I think that it makes it hard to ...
2
votes
1answer
3k views

Calling static method from instance of class

As a developer I am fan of static methods. Recently I come across difference between OOP languages about this static methods. All OOP language use static method to access any method without ...
7
votes
3answers
3k views

Is objective-C++ being phased out? [closed]

Is apple phasing out support for objective-c++? Note the following: In the Objective-C language manual, there used to be a section on mixing objective-c and c++. That section is now missing. Links ...
6
votes
1answer
3k views
1
vote
4answers
208 views

Security in an iOS game?

I'm part of a team building an iOS game which has multiplayer elements. A concern right now is how to make the game more secure, from user manipulation. I know there's a lot of multiplayer games out ...
4
votes
5answers
1k views

Are design patterns independent of programming languages?

I have been recently working on Objective C and came across use of Delegate pattern. I had seen most of the common patterns theoretically in Java, thanks to the Head First book. But at times looking ...
19
votes
6answers
1k views

The importance of duplicate code removal [duplicate]

I tried to explain to a coworker the gravity of having duplicate code in a project, on this piece of code: + (void)createIapInParse:(SKPaymentTransaction *)transaction { Reachability *reach = ...
0
votes
1answer
128 views

What effect does using multiple childViewControllers views inside a ContainerViewController have on memory?

I have three childViewController views inside my ContainerViewController and these three views are inside a horizontal scroll view. My intention is to build an app that has a custom camera on one ...
0
votes
1answer
77 views

Macro guard in Objective-C

I have noticed that many famous libraries written in Objective-C (eg. AFNetworking) use the macro guard inside their header files. Im aware that the #import directive, which works exactly like ...
0
votes
0answers
205 views

Delegate method privately called from delegate itself?

One has established design patterns so ingrained in their brain, that when sometimes somebody does something unexpected, it is a revelation. My colleague in an iOS project did call the delegate ...
1
vote
0answers
86 views

Can PhoneGap and RoboVm work in harmony?

The Goal is to make an iOS app using phonegap and java. When writing phonegap plugins that interact with native code (objective-c) would it be possible instead to make it interact with java when using ...
0
votes
1answer
239 views

Approach to managing multiple services like Evernote, Google drive, dropbox in iOS

I'm trying to think up a scenario when I'd have three different forms of NSData (or whatever) to be sent to three different services like Evernote, Google drive, Dropbox. Granted, each of those has ...
0
votes
1answer
278 views

How does Telnet work?

Is telnet just a simple socket connection? I usually have a difficult time in the networking area so I use some code from the internet to help me out, but I can't seem to find a library for Telnet in ...
1
vote
1answer
140 views

Should I implement a function or a method?

Once in a while I encounter a C function in my colleagues' code. Mostly it is in some helpful objective categories, and those functions are mostly an internal calculation of something or a ...
15
votes
4answers
7k views

success:/failure: blocks vs completion: block

I see two common patterns for blocks in Objective-C. One is a pair of success:/failure: blocks, the other is a single completion: block. For example, lets say I have a task that will return an object ...
0
votes
1answer
92 views

Drawbacks to redefining method in precompiled header

I have a lot of calls to NSLog(...). I need to change all of these calls to CLSNSLog(...). So I added this to my precompiled header (.pch): #import <CrashlyticsFramework/Crashlytics.h> #define ...
1
vote
0answers
553 views

What are the bad points of using Core Data for iOS like an ORM

I just starting to use Core Data for my iOS app and I am thinking about how use Core Data for my needs. What are the features of my app: The user look for products proposed from a catalog. The user ...
3
votes
2answers
2k views

Objective-C style: Do I implement factory methods or init methods?

I'm new to Objective-C programming, and creating various classes for an iOS application I'm working on. When creating objects, it seems like many classes in the built-in frameworks use the "static ...
3
votes
1answer
746 views

Can Objective C categories serve the same purpose as Traits do in Scala?

The statement of the question seems little abstract to me, so please read the details below. Since the time when C++ was the first choice Object Oriented Language for almost anything, we had a big ...
1
vote
2answers
328 views

How can NSObject contain an NSString if NSString is an NSObject

How can NSObject contain an NSString if NSString is an NSObject /* NSObject.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ (NSString *)description; NSObject has a property named ...
-2
votes
1answer
2k views

in Objective-C, value of type double/float can only be NAN, INFINITY, & normal number?

I knew double or float value can be not only normal value(-1.3, 0, 1.0, 2.3) but also NAN and INFINITY in Objective-C. Is there other special values except for NAN and INFINITY for double/float value ...
1
vote
1answer
214 views

Create an Objective-C category to route methods depending on a specified type

For one project, I needed to find a solution to avoid code like this: if ([self.desiredColor isEqualToString:@"Red"]) [self constructRedMenu]; else if ([self.desiredColor ...
1
vote
1answer
107 views

Is it bad practice to include two types of views in the same class?

In my app, I use a widget with a loading spinner to signify that a network request is waiting. On failure, there will be another view which contains a failure message and a "Reload" button. My ...
1
vote
4answers
260 views

Difference between the two enums

I came across an enum definition :- typedef enum NSInteger { kBorderTypeNone = 0, kBorderTypeLeft = 1 << 0, kBorderTypeRight = 1 << 1, kBorderTypeTop = 1 << ...
0
votes
1answer
241 views

In objective C, where does the inheritance chain end? [closed]

In objective C, classes are objects, but what object owns the class objects? I am trying to get as detailed an understanding of iOS programming as I can, and this question popped into my head, so I ...
0
votes
0answers
49 views

Use Objective-C protocols like Java interfaces [duplicate]

I'm a Java developer moving to Objective-C. So far in Objective-C I've seen protocols used extensively to implement the delegate pattern, but I haven't seen then to add a layer of abstraction in the ...
23
votes
2answers
7k views

Why is Objective-C not widely used beyond Cocoa environments?

Objective-C features nice object orientation, simplicity, elegance, and (as a superset of C), low level ability. It could seem like the simple, modern alternative to C++ that many people look for and ...