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

  • Home
  • SEARCH
  • 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 963967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:45:09+00:00 2026-05-16T01:45:09+00:00

Whenever my method sets an object to onTouchEventReceiver , it gets lost when another

  • 0

Whenever my method sets an object to onTouchEventReceiver, it gets lost when another method is called by another thread.

//In header
id onTouchEventReceiver;
SEL onTouchSelector;

- (void) setOnTouchSelector:(SEL)sel withObject:(id)obj
{
    NSLog(@"setting obj to %@",obj);
    onTouchSelector = sel;
    [self setOnTouchEventReceiver:obj];
    NSLog(@"====----- %@",onTouchEventReceiver); //That works
}

//Another thread calls this
- (void) touchEventReceived
{
    NSLog(@"firing a selector at %@ by %@",onTouchEventReceiver,self);

    //Why on earth does that happen?????

    if (onTouchEventReceiver != nil) //onTouchEventReceiver is (null)
    {
        [onTouchEventReceiver performSelector:onTouchSelector];
    }
}

The code produces the following:

2010-07-18 23:40:54.776 app[737:903] setting obj to <appCtl: 0x10fa00>
2010-07-18 23:40:54.787 app[737:903] ====----- <appCtl: 0x10fa00>

… after the screen was touched …

Got touch event at coordinates 154 x 243 , mask : 2
2010-07-18 23:41:39.342 app[737:3b03] AALayer hit test passed : <AALayer: 0x110af0>
2010-07-18 23:41:39.348 app[737:3b03] firing a selector at (null) by <AALayer: 0x110af0>

Why does that happen? The code seems to be correct .

  • 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-16T01:45:10+00:00Added an answer on May 16, 2026 at 1:45 am

    The AALayer in your log message makes me think that it might be a subclass of CALayer. If this is the case, then you might easily have two separate objects. CALayers get duplicated for presentation by the rendering machinery. If this is the problem, you need to subclass -initWithLayer: to copy your extra ivars appropriately.

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

Sidebar

Ask A Question

Stats

  • Questions 497k
  • Answers 497k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Check where it's hanging in Application.Run; disable Just My Code… May 16, 2026 at 11:54 am
  • Editorial Team
    Editorial Team added an answer Any chance of posting some code? Could this be an… May 16, 2026 at 11:54 am
  • Editorial Team
    Editorial Team added an answer function currentSlideFromParams() { var result = window.location.hash.match(/#([0-9]+)/); if (result )… May 16, 2026 at 11:54 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I would like to ask, which method has been called whenever the user quit
I'm trying to initiate an ajax request whenever a person changes the value of
I am currently working on one messy web application. In this application, there is
I'm looking for something similar to the Proxy pattern or the Dynamic Proxy Classes
I have code that looks like this: public class Polynomial { List<Term> term =
Experimenting using different approaches and reducing code maintenance I have ended up using reflection
I read some documentations about classloaders, but im still not sure where and why
I was comparing an old PHP script of mine versus the newer, fancier Django
In my app, one if my goals is to use UISegmentedControl to choose the
I currently have 26 tables in a MYSQL database. My boss wants me to

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.