objective-c-runtime Questions

3

Solved

Looking at the Objective-C runtime library source code, particularly at objc-runtime-new.mm, I saw some functions and even comments which referred to lazy and non-lazy classes. It seems that classe...
Lipography asked 9/3, 2013 at 20:38

1

Solved

The warning below gets occasionally reported in the Xcode console. What does this warning mean and how do I stop it from happening? objc[4082]: Lazily named class 0x7ffee3d07ba0 wasn't named by laz...
Yocum asked 18/11, 2020 at 1:56

6

Solved

I know that OBJC_ASSOCIATION_ASSIGN exists, but does it zero the reference if the target object is dealloced? Or is it like the old days where that reference needs to get nil-ed or we risk a bad ac...
Endocrinotherapy asked 15/5, 2013 at 16:0

1

Solved

Methods called via Selector don't respect default parameter values. EXAMPLE If I have a button wired up to call a function via a selector: func setupButton() { self.button.addTarget(self, actio...
Achromatous asked 26/8, 2019 at 18:34

10

Solved

I need a way to pass a property and get the name assigned to it. Any suggestions? @property (nonatomic, retain) MyObject *crazyObject; NSString *str = SOME_WAY_TO_GET_PROPERTY_NAME(crazyObject); ...

1

Solved

I have Objective-C Protocol and Interface implementation as below: @protocol Animal <NSObject> -(void)walk; @end @interface Cat : NSObject<Animal> @end @implementation Cat -(void)wa...
Lethbridge asked 11/1, 2019 at 6:44

4

Solved

Is there any means of reflection in Objective-C that would allow you to write generic NSCoding implementations by inspecting the public properties of an object and generating generic implementation...

7

Solved

Im trying to use this method: class_addMethod() which in Obj-c is used like this: class_addMethod([self class], @selector(eventHandler), imp_implementationWithBlock(handler), "v@:"); And Im usin...
Legman asked 29/1, 2015 at 10:11

4

Solved

object_getIvar(id object, Ivar ivar) reads the values of iVArs properly but fails on a BOOL type iVar and crashes. I need the values of all iVars of a class.Is there any way to resolve it.
Ceramist asked 2/12, 2011 at 12:19

4

Solved

I have a project that has a dependency (installed via CocoaPods) using SocketRocket and have imported a static library from HeapAnalytics. Apparently the HeapAnalytics library already uses SocketRo...
Rochester asked 1/6, 2015 at 19:41

4

am exposing swift API's in Objective-C and the Objective-C runtime. When i add "@objc" before the function throws an error "Method cannot be marked @objc because its result type cannot be represen...

1

Solved

In Apple's Key-Value Observing Implementation Details document, it says the implementation creates a subclass to forward setter methods. The subclass replaces the original class. Why not just use ...
Nerine asked 4/2, 2018 at 16:15

3

To simplify, let's say I have a function like that void myFunc(id _self, SEL _cmd, id first, ...) { } In that method I wanna call the implementation(imp) on the superclass of _self. I can reach...
Somber asked 3/9, 2012 at 15:20

3

Solved

I am trying to get a string name of a class from the class object itself. // For instance [NSArray className]; // @"NSArray" I have found object_getClassName(id obj) but that requires an instanc...

2

In Swift 3, I had a snipped of code that called into Objective-C runtime to check if a certain class is present. guard let managerClass = NSClassFromString("ASIdentifierManager") as? NSObjectProto...
Cho asked 30/8, 2017 at 10:10

1

Recently, I have one problem. The clang can translate Objective-C to c++ use -rewrite-objc. So I think, the first step. clang compile Objective-C to C++. And then compile only can use c++ compiler....
Emmi asked 15/6, 2017 at 7:28

3

Solved

What is equivalent swift code for below Objective-C code. I couldn't find swift topic with runtime concept. #import <objc/runtime.h> Class class = [self class]; Trying to get class object...
Dauphine asked 25/6, 2014 at 8:27

2

Solved

I want to transform an instance of an object into an instance of a subclass of that object class, so that I can use the additional methods and properties of that subclass, in Objective-C. How can ...
Autry asked 6/12, 2014 at 20:52

1

I am trying to search to prevent the Method Swizzle in my current library but more or less every documentation or blog post that i found are about how to implement Swizzling. There are couple of qu...
Selfabsorption asked 30/1, 2017 at 18:40

1

Solved

To have an associated object in Swift, you simply use a memory address as a handle, and then use the objc calls. The usual example code you can google everywhere is: var keyA:UInt8 = 0 var keyB:U...
Cultism asked 24/1, 2017 at 12:13

1

Solved

I have some Swift 3 code to decode an iOS Objective-C protocol (which has a Swift counterpart). After concluding Swift 3 reflection was not developed enough to accomplish what I needed, I stumbled ...
Polymer asked 6/1, 2017 at 9:3

3

I need access address of property but have problem. example code is @interface Rectangle : NSObject { SDL_Rect wall; SDL_Rect ground; } @property SDL_Rect wall; @property SDL_Rect ground; @end ...
Hunsinger asked 14/12, 2014 at 10:56

2

Solved

While it is possible to replace setMyProperty: method in obj-c, I'm wondering how to do it in swift? For example I want to replace UIScrollView::setContentOffset:: let originalSelector: Selector ...
Tysontyumen asked 4/8, 2016 at 22:17

4

Solved

In Objective-C I can test whether a given class or instance responds to certain selectors. But how can query a class or instance for all its methods or properties of a class (e.g. a list of all met...
Meunier asked 19/1, 2010 at 15:44

1

Solved

I'm essentially looking for a way to detect when/what third party libraries swizzle. I recently ran into a situation where an ad library used an oddball fork of AFNetworking. AFNetworking swizzles ...
Heisenberg asked 20/7, 2016 at 18:35

© 2022 - 2024 — McMap. All rights reserved.