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
1answer
17 views

Swift: for-in with two values

I started learning C some weeks ago and today I started learning Swift. The code is the following: import Foundation let interestingNumbers = [ "Prime": [2, 3, 5, 7, 11, 13], ...
1
vote
0answers
24 views

Xcode rolling video architecture

I am going to writing an App that records video but to save on memory space I want to allow the user to continually record and then, when something happens, they can save that period of time (post the ...
3
votes
2answers
238 views

Why does Swift not require semicolons? [closed]

I normally code in either c# or Objective-C and recently took it upon myself to learn Apple's new programming language - Swift. The first thing I noticed is that you don't need to add semicolons to ...
3
votes
1answer
107 views

Why does Objective-C store objects on the heap instead of on the stack?

I have a basic understanding of what a "stack" and "heap" are. You use a stack to store items in memory that should be read and/or removed in a last-in-first-read/removed manner. To steal another ...
1
vote
0answers
49 views

Securing a private API used by an iOS App

I have an app that uses an API server and I do not want to have anything other than it to be able to use that API. I know this isn't totally possible, but I want to do what I can. I don't think my ...
4
votes
1answer
56 views

Best practice for defining and keeping related stateless methods together in Objective-C

I have a few methods which are stateless: loginWithEmail: password: completion: signUpWithEmail: password: completion: resetPasswordForUsername: completion: Currently what I do is I create a class ...
1
vote
1answer
103 views

Why isn't the isa pointer hardwired in Objective-C classes?

I've been studying the Objective-C runtime for some years, and even hacked libobjc a little bit (both Apple's and GNUStep's), and I've been wondering about a design decision on the compilers. Every ...
0
votes
2answers
177 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
165 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 ...
5
votes
1answer
183 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
22 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 ...
0
votes
1answer
90 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 ...
2
votes
2answers
170 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; ...
1
vote
1answer
85 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 ...
0
votes
1answer
501 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
374 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
129 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?
1
vote
1answer
213 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 ...
11
votes
3answers
827 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 ...
2
votes
1answer
330 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 ...
2
votes
1answer
532 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 ...
12
votes
1answer
565 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
107 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
4answers
234 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 ...
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
145 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
97 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 ...
1
vote
0answers
93 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
265 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
296 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 ...
93
votes
5answers
41k 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 ...
1
vote
1answer
141 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 ...
2
votes
1answer
4k 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 ...
0
votes
1answer
96 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
1answer
202 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. ...
1
vote
0answers
601 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 ...
0
votes
0answers
221 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
2answers
343 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 ...
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 ...
0
votes
1answer
149 views

Significance of many-to-many relationships? [closed]

How important are to-many relationships in iOS programming? Do you often hold a list of pointers to objects in an array in your codes? I don't think I fully understand the concept of to-many ...
0
votes
1answer
249 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 ...
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 ...
0
votes
2answers
214 views

How to remove redundant code that enables button. Or “if” statement

I got probably "micro optimization" problem. I got "History number", "Next Number", "Reset" buttons, as well "label" for text. Every time I click At "Next number" button I would like to show random ...
1
vote
4answers
276 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
211 views

detect if a combination of string objects from an array matches against any commands

Please be patient and read my current scenario. My question is below. My application takes in speech input and is successfully able to group words that match together to form either one word or a ...
3
votes
1answer
148 views

Testing: Should I wrap system notifications and send my own?

In the current Cocoa app I'm working on, I've got an object, RecordScheduler, which responds to two types of notifications, "day did pass" and "quicksaving interval did pass". In both cases, the ...
1
vote
1answer
216 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 ...
0
votes
2answers
240 views

Is it acceptable to use C11 generic macros in Objective-C to box numbers?

I was getting tired of repeating types when writing things like this: NSDictionary* d = @{@"so": [NSNumber numberWithInt:index]), @"much": [NSNumber numberWithBool:accepted]), ...
-2
votes
3answers
135 views

Is explicit else needed in initialisers? [duplicate]

I have a custom designated initialiser like this: - (id)initWithLocation:(CLLocation *)location { if (location == nil) { return nil; } self = [super init]; if (self) ...