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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:19:13+00:00 2026-05-27T12:19:13+00:00

To an id -variable, I can assign a block and call it afterwards; with

  • 0

To an id-variable, I can assign a block and call it afterwards; with an opaque pointer id this doesn’t work (EXC_BAD_ACCESS).

In RestKit, the userData-object is an “opaque pointer”; now, I’d like to assign a block variable to it to call this block after the request finished. But because of this EXC_BAD_ACCESS it doesn’t work. Is there a chance to user this opaque pointer to assign a block to it?

Thanks a lot!

EDIT:

// this works
id testId = ^{
   NSLog(@"hello");
};

testId();

// this doesn't - but it's important to know RestKit
void (^postNotification)(void) = objectLoader.userData // EXC_BAD_ACCESS
postNotification();

objectLoader is of type RKObjectLoader (subclass of RKRequest), and the API says about userData: An opaque pointer to associate user defined data with the request.

  • 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-05-27T12:19:13+00:00Added an answer on May 27, 2026 at 12:19 pm

    You need to show us how you’re creating the block and assigning it to userData to be sure, but my guess is you’re not copying the block and it’s going out of scope, like this:

    objectLoader.userData = ^{ ... };
    

    A blocks are created on the stack. That means when the compound statement (e.g. function) enclosing it ends, the block is no longer valid. If you want the block to survive, you need to copy it to the heap:

    objectLoader.userData = [^{ ... } copy];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why can't I assign object variables within the try block? If I attempt to
How can I assign a variable(var) to a json object which is returned from
can we assign a data column value to a variable and use this variable
For example, i can assign the result of function call to a variable. Or
can we assign null value to struct type of variable? struct MyStruct { }
In ANSI C++, how can I assign the cout stream to a variable name?
How can we re assign the value of a StringBuffer or StringBuilder Variable? StringBuffer
Where have you mostly used the initialization block? Can you use these to assign
how i can assign rjs prompt value to a variable page << prompt('Enter the
In UNIX you can assign the output of a script to an environment variable

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.