Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-19-2008, 02:03 PM   #1 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 45
Default modifying layer that is being finalized

Has anyone gotten this message while debugging an application? I get it after I click the same button a couple times.

Thanks,
Rolando
rolandolopez is offline   Reply With Quote
Old 12-22-2008, 04:25 PM   #2 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 45
Default

Anyone have a clue?
rolandolopez is offline   Reply With Quote
Old 01-31-2009, 05:13 AM   #3 (permalink)
Registered Member
 
Join Date: Aug 2008
Posts: 4
Default

Wish I could help! I've just started getting it in my application too

Did you ever get to the bottom of it?
debug77 is offline   Reply With Quote
Old 02-02-2009, 10:55 AM   #4 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 45
Default

I believe I had released the button before I should have. I removed the [button release]; messages and it now works. But i'm not sure if that's the best solution since the buttons are never released.
rolandolopez is offline   Reply With Quote
Old 02-12-2009, 04:09 AM   #5 (permalink)
New Member
 
Join Date: Feb 2009
Posts: 64
Default

I had the same problem!
I tried several things, but the best you can do is using [button removeFromSuperview] instead of [button release].
This will remove it from the view and reduce the retainCount by 1.
Neocron is offline   Reply With Quote
Old 06-23-2009, 06:12 AM   #6 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 4
Default

Quote:
[button removeFromSuperview]
Indeed this does solve the problem when you get the strange error:

Quote:
modifying layer that is being finalized
In my case, the button I was creating was actually in a seperate thread than the main thread. Along with that, the button was being created in a thread that was executing opengl.

My aim was to use a custom Edit box with custom font and behavior, then use the UITextView to display the keyboard.

After a long and ardous journey of 3 days, filled with thread synchronization issues and other such niceties as UITextView not calling overloaded functions, and also not correctly sending touchEvents down the chain as expected, the final product was finally completed.

A completely independent text box that interacts with the UIKeyboard.

I have included the header file and the source file for reference. If anybody is interested in doing something similar, just hit me up.

Code:
#import <UIKit/UIKit.h>
#import <UIKit/UITextField.h>


//CLASS INTERFACE:

@interface SageTextField : UITextField <UITextFieldDelegate> 
{
}

- (id)initWithCoder:(NSCoder *)inCoder;
- (id)initWithFrame:(CGRect)frame;
- (void)layoutSubviews;

@end
Code:
#import	<SageTextField.h>
#import "SageImpl.h"

//CLASS IMPLEMENTATIONS:
@implementation SageTextField

- (id)initWithCoder:(NSCoder *)inCoder 
{
    if (self = [super initWithCoder:inCoder])
        self.delegate = self;
	
    self.text = @"initcoder";
    return self;
}

- (id)initWithFrame:(CGRect)frame 
{
    if (self = [super initWithFrame:frame])
		self.delegate = self;

    self.text = @"init";
	return self;
}

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
	UITouch *touch;
	CGPoint point;
	
	//UIWindow* window = touch.window;
	
	touch = [[touches allObjects] objectAtIndex:0];
	point = [touch locationInView:self];
	
	point.x += self.frame.origin.x;
	point.y += self.frame.origin.y;
	
	SageAddMessage(IPHONE_MSG_TOUCHBEGAN, &point, sizeof(point));
	[super touchesBegan:touches withEvent:event];
}

- (void)layoutSubviews
{
	// Do nothing - there are no subviews. 
	
	// Default method attempts to check for a URL in text and causes threading lock issues during render!?!
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
	UITouch *touch;
	CGPoint point;
	
	touch = [[touches allObjects] objectAtIndex:0];
	point = [touch locationInView:self];
	
	point.x += self.frame.origin.x;
	point.y += self.frame.origin.y;
	
	SageAddMessage(IPHONE_MSG_TOUCHMOVED, &point, sizeof(point));
	
	[super touchesMoved:touches withEvent:event];
}

- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
	UITouch *touch;
	CGPoint point;
	
	touch = [[touches allObjects] objectAtIndex:0];
	point = [touch locationInView:self];
	
	point.x += self.frame.origin.x;
	point.y += self.frame.origin.y;
	
	SageAddMessage(IPHONE_MSG_TOUCHENDED, &point, sizeof(point));
	
	[super touchesEnded:touches withEvent:event];
}


- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
	// Touches ended no longer called on UITextView in SDK 3.0.
	UITouch *touch;
	CGPoint point;
	
	touch = [[touches allObjects] objectAtIndex:0];
	point = [touch locationInView:self];
	
	point.x += self.frame.origin.x;
	point.y += self.frame.origin.y;
	
	SageAddMessage(IPHONE_MSG_TOUCHENDED, &point, sizeof(point));
	
	[super touchesCancelled:touches withEvent:event];
}

- (void)dealloc 
{
    [super dealloc];
}

@end
I won't post the custom Text Editor class as it is far too much code, and it's all written in C++.

Also there are chunks of intermediate code segments that are written in a blend of Objective C and C++.
MrPiotr is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Stats
Members: 157,865
Threads: 88,916
Posts: 379,299
Top Poster: BrianSlick (7,072)
Welcome to our newest member, loved1943
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:15 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0