Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7815329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:29:28+00:00 2026-06-02T05:29:28+00:00

I am doing meta-programming with objective-C and try to automate some of an application

  • 0

I am doing meta-programming with objective-C and try to automate some of an application functions. Thus, I am not changing the source code files and the view controllers of the application but from another file I am managing to get the UI navigation stack and I am using Objective-C Runtime Reference to find the tappable UI elements and the actions. for example for a button I found the target and action and call objc_msgSend to programatically fire the event.

step = (NSObject *)objc_msgSend(element.target, NSSelectorFromString(element.action));

However I need to be notified when the action was done, or in other word, I need to wait until the action was done and then continue my automation. I was thinking of using NSNotificationCenter

//To raise an event
[[NSNotificationCenter defaultCenter] postNotificationName:FIRE_EVENT_NOTIFICATION object:self];

but doesn’t look like working.

I am even thinking of using Categories or
So I am not sure if there is anyway to wait for objc_msgSend and where should I continue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T05:29:30+00:00Added an answer on June 2, 2026 at 5:29 am

    It isn’t entirely clear what you are trying to do and the exact problem that you are having but I’ll have a go at answering your question.

    If I understand correctly you are trying to fire the action associated with a UI element, presumably something like a button press. You have a reference to the element in element and you want to call the associated action on the elements target. The following assumes the action is an IBAction.

    The simplest way to do this would presumably be:

    [element.target performSelector:element.action];
    

    Note: element.action almost certainly returns a SEL (a selector) not an NSString so there is no need to run it through NSSelectorFromString().

    Normally, an IBAction event would receive the clicked on element as a parameter so I think you might want to do:

    [element.target performSelector:element.action withObject:element];
    

    IBAction‘s have no return value so there is nothing to store when the method returns.

    performSelector: and performSelector:withObject: will only return once the called method has run to completion. You shouldn’t need to organise some sort of notification of the action completing.

    However, if the action you are calling is launching code on another thread then it is possible that the called action will return before the result of pressing the button has completed. This will be difficult to monitor without knowledge of the code that is being run.

    If, for some reason, you have to use objc_msgSend then you would use the following:

    objc_msgSend(element.target, element.action, element);
    

    Like performSelector:, objc_msgSend will only return when the called method has run to completion.

    Hopefully I have understood your question and my answer makes sense, it is entirely possible I’m barking up the wrong tree though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note: I have read https://meta.stackexchange.com/questions/128548/what-stack-overflow-is-not/129362#129362 It says try to write the code yourself and
Doing an ajax get request works as expected using the following code: $.ajax({ type:
Doing my first SL4 MVVM RIA based application and i ran into the following
Doing some jquery animation. I have certain divs set up with an attribute of
Doing some homework here (second assignment, still extremely green...). The object is to read
Doing code analysis of the project and get the message Reference-counted object is used
Inspite of putting the following meta tag I am not getting the expected result:
I am doing some work for a French client and so need to deal
I was doing some tests on IE 8 on a standards-compliant page, with a
I'm doing my first steps in Python 2.7 Metaprogramming, and wrote following code :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.