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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:39:09+00:00 2026-06-12T13:39:09+00:00

I’m using UISpec for automated testing in my project. Everything was fine until Apple

  • 0

I’m using UISpec for automated testing in my project. Everything was fine until Apple released xCode 4.5 with iOS 6 SDK. Now UISpec project can’t be compiled because a list of errors in category of UITouch class. Here is the code:

//
//  TouchSynthesis.m
//  SelfTesting
//
//  Created by Matt Gallagher on 23/11/08.
//  Copyright 2008 Matt Gallagher. All rights reserved.
//
//  Permission is given to use this source code file, free of charge, in any
//  project, commercial or otherwise, entirely at your risk, with the condition
//  that any redistribution (in part or whole) of source code must retain
//  this copyright and permission notice. Attribution in compiled projects is
//  appreciated but not required.
//

@implementation UITouch (Synthesize)

//
// initInView:phase:
//
// Creats a UITouch, centered on the specified view, in the view's window.
// Sets the phase as specified.
//
- (id)initInView:(UIView *)view
{
    self = [super init];
    if (self != nil)
    {
        CGRect frameInWindow;
        if ([view isKindOfClass:[UIWindow class]])
        {
            frameInWindow = view.frame;
        }
        else
        {
            frameInWindow =
            [view.window convertRect:view.frame fromView:view.superview];
        }

        _tapCount = 1;
        _locationInWindow =
        CGPointMake(
                    frameInWindow.origin.x + 0.5 * frameInWindow.size.width,
                    frameInWindow.origin.y + 0.5 * frameInWindow.size.height);
        _previousLocationInWindow = _locationInWindow;

        UIView *target = [view.window hitTest:_locationInWindow withEvent:nil];

        _window = [view.window retain];
        _view = [target retain];
        _phase = UITouchPhaseBegan;
        _touchFlags._firstTouchForView = 1;
        _touchFlags._isTap = 1;
        _timestamp = [NSDate timeIntervalSinceReferenceDate];
    }
    return self;
}

//
// setPhase:
//
// Setter to allow access to the _phase member.
//
- (void)setPhase:(UITouchPhase)phase
{
    _phase = phase;
    _timestamp = [NSDate timeIntervalSinceReferenceDate];
}

//
// setPhase:
//
// Setter to allow access to the _locationInWindow member.
//
- (void)setLocationInWindow:(CGPoint)location
{
    _previousLocationInWindow = _locationInWindow;
    _locationInWindow = location;
    _timestamp = [NSDate timeIntervalSinceReferenceDate];
}

@end

compiler gives errors on lines like “_tapCount = 1;” error is “Uknown type name “_tapCount”; did you mean …?”

what i did:

  1. get a list of instance variable for UITouch class, using run time function “class_copyIvarList” and checked if these variables still exist. they do.
  2. tried to change needed values at runtime, like

    uint uPhase = UITouchPhaseBegin;
    object_setInstanceVariable(self, “_phase”, &uPhase);

or

Ivar var = class_getInstanceVariable([self class], "_phase");
object_setIvar(self, var, [NSNumber numberWithInt:UITouchPhaseBegin]);

in both cases invalid value was written to “_phase” member. i checked that by printing description of the UITouch instance to console. it was written “phase: Uknown”.

then i decided to try key-value coding and implemented it like:

[self setValue:[NSNumber numberWithInt:1] forKey:@"tapCount"];
[self setValue:[NSNumber numberWithInt:UITouchPhaseBegin] forKey:@"phase"];

now it gave some results. compile errors are eliminated, member values of UITouch instance are changed but still nothing happens. i set breakpoints in “touchesBegan:…” and “touchesEnded:…” methods of appropriate UI object (it was UIButton in my case) and debugged it. these methods are called, but nothing happens – button handler is not called.

also due to KVC i had to comment methods “setPhase” and “setLocationInWindow” of UITouch category, otherwise endless recursion happens. setter of the property calls itself.

now i’m out of ideas. this category is “Created by Matt Gallagher on 23/11/08.”, that means it is a third party code for UISpec. so i hope it is used somewhere else except the UISpec and somebody knows a work around.

thanks.

P.S. i know that this is a private API. it is not included to the release configuration of the project. i need it only for automated testing

  • 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-12T13:39:10+00:00Added an answer on June 12, 2026 at 1:39 pm

    You do not have to change anything in UIQuery.m file. Please add following lines of code to UIQuery.h file :

    #ifdef __IPHONE_6_0
    @interface UITouch () {
        NSTimeInterval _timestamp;
        UITouchPhase _phase;
        UITouchPhase _savedPhase;
        NSUInteger _tapCount;
    
        UIWindow *_window;
        UIView *_view;
        UIView *_gestureView;
        UIView *_warpedIntoView;
        NSMutableArray *_gestureRecognizers;
        NSMutableArray *_forwardingRecord;
    
        CGPoint _locationInWindow;
        CGPoint _previousLocationInWindow;
        UInt8 _pathIndex;
        UInt8 _pathIdentity;
        float _pathMajorRadius;
        struct {
            unsigned int _firstTouchForView:1;
            unsigned int _isTap:1;
            unsigned int _isDelayed:1;
            unsigned int _sentTouchesEnded:1;
            unsigned int _abandonForwardingRecord:1;
        } _touchFlags;
    }
    @end
    #endif
    

    Thanks.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.