It seems like instanceMethodSignatureForSelector is a class method, while methodSignatureForSelector is an instance method. However, their description and use cases do not bring me to this conclusion. So what is the difference?
What is the difference between methodSignatureForSelector and instanceMethodSignatureForSelector?
1.1k Views Asked by AudioBubble At
2
There are 2 best solutions below
0
Thomas Tempelmann
On
While instanceMethodSignatureForSelector is a function you'd invoke to get signatures of any class's methods, methodSignatureForSelector is something you would primarily overrride to provide alternative methods to the runtime if it looks up a method of a protocol.
(Jay's answer is giving an example of that but I thought I should offer this short explanation in case you haven't come to this conclusion yourself yet.)
Related Questions in IOS
- URLSession requesting JSON array from server not working
- Incorrect display of LinearGradientBrush in IOS
- Module not found when building flutter app for IOS
- How to share metadata of an audio url file to a WhatsApp conversation with friends
- Occasional crash at NSURLSessionDataTask dataTaskWithRequest:completionHandler:
- Expo Deep linking on iOS is not working (because of Google sign-in?)
- On iOS, the keyboard does not offer a 6-character SMS code
- Hi, there is an error happened when I build my flutter app, after I'm installing firebase packages occurs that error
- The copy/paste functionalities don't work only on iOS in the Flutter app
- Hide LiveActivityIntent Button from Shortcuts App
- While Running Github Actions Pipeline: No Signing Certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID
- Actionable notification api call not working in background
- Accessibility : Full keyboard access with scroll view in swiftui
- There is a problem with the request entity - You are not allowed to create 'iOS' profile with App ID 'XXXX'
- I am getting "binding has not yet been initialized" error when trying to connect firebase with flutter
Related Questions in IPHONE
- How to control the volume of an iPhone programmatically in objective-c
- my website crash on safari The site sometimes crashes and I can't recover the crash
- Postal Framework crash in iPhone but runs successfully in simulator
- Xcode 15 building failure when using iphone 15 as simulator, using ios 17
- Images uploaded via Active Storage not displaying in Active Admin or on certain devices
- Any problem with creating provisioning profile with old Iphone?
- Does anyone know how to make iPad layout the same as iPhone's? Size wise the text and overall layout get's smaller when I run the app on the iPad
- Keyboard not appearing when connecting smart card reader to iPhones with type-c port. i.e. iPhone 15/ 15 pro
- Access the list of SIM mobile numbers installed in the iPhone
- Can we produce haptics and record from microphone the haptic sound at the same time on iOS?
- SwiftUI's localized string do not load from main bundle despite using the main bundle identifier (an xcode bug?)
- Cordova iOS only app upload through transport requires WKWatchKitApp
- Amazon s3 video is not played on Iphone
- build getting failed for ios xcode build -flutter app
- "Error when Importing 'mysdk' into iOS Demo App: dyld Library not loaded: @rpath/MQTTClient.framework/MQTTClient"
Related Questions in NSOBJECT
- How can I implement struct to inherit a protocol with <NSObject>
- What do these Xcode warnings mean?
- system.FormatException: 'Input string was not in a correct format.' in IAppversion class. Conversion from NSObject to string
- Swift: Access struct/class variables by string name
- How to unarchive MLMultiArray with NSKeyedUnarchiver?
- Xamarin.IOS / c# - Get NSObject values
- Is it possible to save a value to CoreData using key path?
- Collectionview in NSObject Class doesn't work?
- Why can't I mutate an NSObject allocated as mutable, referenced as immutable, then cast back to mutable?
- Setting Observer for Swift Objects/Properties
- Xcode code completion suggests `printContent(_)` above `print(_)`
- Xcode 13 ('Product' is ambiguous)
- Core Data NSObject to Int
- Swift defined convenience init is not accessible in objective-c
- Is there a way to assign a variable of Swift enum type to a variable of NSObject type?
Related Questions in NSINVOCATION
- NSInvocation getArgument NSString/CFString will lead to bad access
- ios invoke block target with copy method,but crashed
- Memory Leak NSInvocationOperation
- why the instance method that is "methodSignatureForSelector:" can be invoke by the class object
- NSInvocation whith multiple arguments not working in Action Extension in iOS 13.0 beta
- Why NSInvocation return value creates a zombie?
- Can I use NSInvocation to hide or show a subclassed UIView without redrawing it?
- Check if on ObjC selector (SEL) has a parameter
- How to extract an argument of 'function' type from NSInvocation
- NSProxy forwardInvocation: Return an new NSProxy instance cause memory leak
- Is there any alternative for NSInvocation in Swift?
- NSInvocation with an enum?
- Step into -[NSInvocation invoke] during debugging
- NSMethodSignature & NSInvocation equivalent in swift 2
- Calling a block though runtime, anything similar to NSInvocation?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
As we have enough info about the Messaging and Message forwarding concepts, lets discuss the solution. In the project I am currently working on , there is a search feature. User can search for results using some criteria. This criteria consists of primary and advanced criteria, and datamodel classes are in place for both. Primary datamodel will contain secondary datamodel as a property. There is a framework which takes care of mapping database tables to specified datamodels. To save or retrieve data, the framework will be sending message to the mapped datamodel class. This framework doesn’t support nested mappings. Primary datamodel class is mapped to the database table, hence the framework will be expecting the columns to be mapped to the properties and will be sending setter and getter messages to the primary datamodel class. Solution is to make the advanced data model a surrogate of the primary data model. In the primary datamodel class, by overriding the following methods, the secondary datamodel is set up as the surrogate for the primary datamodel class.
If I had used the initial approach of manually adding setters and getters, I would have ended up writing as many methods as twice the number of properties and had to make sure all the method signatures mimics the advanced criteria properties. Any changes to the name of the properties is a good entry point for regressin and code maintenance is going to be a mess. Other approach is to maintain a single datamodel which will represent all the criteria which will create other issues as the requirements for iPhone and iPad are different. Message forwarding approach reduced the amount of manual effort required and will be scalable even if there are changes to the datamodels.
Refrence : http://blog.imaginea.com/message-forwarding-and-surrogate-objects-in-objective-c/