Questions tagged [objective-c-runtime]

The Objective-C runtime is a runtime support library provided with an implementation of the Objective-C language. Its API allows dynamically creating and configuring classes at runtime, as well as introspecting existing classes, methods, properties, and method implementations.

Use this tag for questions that involve interacting with the Objective-C runtime. This includes fundamental methods of NSObject, <NSObject>, and NSProxy, as well as the API exposed by the files in <objc/> such as <objc/objc-runtime.h>.

Very few Objective-C development tasks require interacting with the runtime:

  • Introspecting the runtime environment, for example to produce a live class browser or graph the relationships between classes or objects at runtime.
  • Creating a proxy object to interact with the message forwarding machinery.
  • Dynamically creating classes and methods at runtime, for example, to support a scripting interface.
  • Optimization hacks for repeated message sends, such as hoisting the method lookup out of the loop and calling the implementing function directly.
  • Writing an application without using objective-c, such as C or C++

Many of these topics have been thoroughly addressed in blog form by Mike Ash in his Friday Q&A series of blog posts.

Related tags that might be more appropriate for your question:

  • Use for questions about the language rather than its runtime, including problems with reference counting.
  • Use or for problems with the Xcode IDE.
  • Use or for problems with these collections of Objective-C APIs.
626 questions
-1
votes
2 answers

How does Objective C decide which C Data Structure are allocated on Heap vs Stack?

How does Objective C decides allocation on heap vs Stack? e.g Take a CG framework, there are some classes which has no pointer classes ( or reference classes ) designed which gets allocated on stack. So does that mean only reference object gets…
Andy
  • 2,493
  • 6
  • 37
  • 63
-1
votes
2 answers

What percent of functions on OS X are called by the Objective-C runtime?

I'd like to get a firmer grasp of how frequently the runtime in any language that requires one is being called. In this case, I'm specifically interested in knowing: Of all the function calls getting executed on an OS X or iOS system in any given…
emish
  • 2,813
  • 5
  • 28
  • 34
-1
votes
2 answers

how can i access to UINavigationController with the string name

my app has the navController and at run time I have NSString *propertyName = @"navController"; and I know it is a type of UINavigationController how can i access to UINavigationController with the string name I might need to use…
ramo
  • 609
  • 2
  • 8
  • 14
-2
votes
3 answers

Can an Objective-C implementation be defined in a header file and also be imported by multiple source files?

I am aware this is not standard or conventional, please read on. I have a header file that defines the interface and implementation of an Objective-C class. Person.h #ifndef Person_h #define Person_h @interface Person :…
ahzeee
  • 7
  • 4
-2
votes
1 answer

Mac OS: How can I run a Cocoa application from within another Cocoa application?

I've written an Objective C runtime debugging tool (in Swift) to help me in the development of another application. Currently, this tool is a standalone Cocoa application that launches normally, with it's own instance of the Objective C runtime, so…
Alexander
  • 59,041
  • 12
  • 98
  • 151
-2
votes
2 answers

how to create a instance of objective-c class by name?

I want get something like: #define weaken(object) ... ---- ClassABCD * abcd = [ClassABCD new]; weaken(abcd); weakAbcd.tag = 0; ---- I have some code below: #define weaken(x) __weak typeof(x) weak##x = x But it only can use "weakabcd", and not…
-2
votes
2 answers

Method swizzling for NSTimer is not working

I am trying to method swizzling for NSTimer in a category. But the swizzling method swizzling_invalidate is never call when send message invalidate to NSTimer object. #import "NSTimer+Test.h" #import @implementation NSTimer…
yehuanwen
  • 13
  • 3
-2
votes
1 answer

Calling a C function messaging style, in objective-c

if I have: test.c int test_func(){ } And I wanted to do : test.m [self test_func] How should my .h files be set up with respect to the test.c file. I have seen a question like this answered here but I failed to bookmark it, and I can't…
cube
  • 1,774
  • 4
  • 23
  • 33
-3
votes
2 answers

how to access parents method through subclass object in objective c

Class1.h: @interface Class1 : NSObject -(void) update; @end @interface Class1 (Private) -(void) private1; -(void) private2; @end Class1.m: @implementation Class1 -(void) update { [self private1]; [self private2]; } -(void) private1 { …
ABHI...
  • 39
  • 6
-5
votes
1 answer

I Want to know JSON Parsing Steps.

enter link description here please parse this link and result in table view.
-7
votes
1 answer

How dynamically initialise object in Swift 3

I use below line of code to allocate an Object(Suppose my Object name is Car) dynamically. [self initliazieObject:[Car class]] - (id)initliazieObject:(Class)model{ id record = [[model alloc] init]; return record; } How I can do this in…
iShameem
  • 101
  • 9
1 2 3
41
42