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 8128833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:03:38+00:00 2026-06-06T08:03:38+00:00

In the past, when I’ve had to compile something on Snow Leopard (or any

  • 0

In the past, when I’ve had to compile something on Snow Leopard (or any older Mac OS X) and use some @selector that’s available on Lion and higher, I’ve done something like this:

if([foo respondsToSelector:@selector(awesomeLionSelector)]) {
    [foo awesomeLionSelector]
}

And this has worked great. So, now I’m trying to do the same thing for a new method that returns a float, but the following line:

float f = [foo awesomeLionSelectorWhichReturnsFloat];

throws a compile error: “cannot convert ‘objc_object*’ to ‘float’ in assignment”. This is because the compiler doesn’t know about the method and has to assume a return type of ‘id’.

What is the proper way to fix this?

  • 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-06T08:03:40+00:00Added an answer on June 6, 2026 at 8:03 am

    EDIT: according to John Caswell comment, the correct runtime function to use is objc_msgSend_fpret(), which returns a double.

    I think you should try your way with: objc_msgSend_stret():

    objc_msgSend_stret

    Sends a message with a data-structure return value to an instance of a class.

      void objc_msgSend_stret(void * stretAddr, id theReceiver, SEL theSelector,  ...)
    

    Something like:

    objc_msgSend_stret(&myFloatReturnValue, foo, @selector(awesomeLionSelector));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the past it was my understanding that the Lat/Lon of an airport had
In the past I've heard that it can be dangerous to rename the Plone
From past few days I'm trying to develop a regex that fetch all the
In the past, I used swiftsuspenders that is an actionscript 3 IoC controller. Basically
In the past, I have had experience calling WCF services or ASMX services, you
In the past I always see that the property called position and positionInPixels are
In past I use dynamic sql and datatable to get data from database. Such
for the past months, googleBot has been hitting a file that does not exist
In the past I've used precompiled headers in VC to speed up compile times
In the past, some of my projects have required me to create a movie

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.