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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.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 01-17-2011, 03:16 PM   #1 (permalink)
Registered Member
iPhone Dev SDK Supporter
 
Join Date: Jan 2009
Location: California
Posts: 40
dougdrury is on a distinguished road
Default Help with: Apps that use non-public APIs will be rejected

I have an app that I submitted to the App Store a few times and I keep getting the same return:

The non-public API that is included in your application is addTarget:action:forEvents. If you have defined a method in your source code with the same name as this API, we suggest altering your method name so that it no longer collides with Apple's private API to avoid your application being flagged in future submissions.

I have done a 'Find in Project' and 'Find in Frameworks' and I can't find where I am redefining addTarget:action:forEvents anywhere. I used otool and strings and otool can't find it either. Strings shows it twice, but it is surrounded by other apple iOS methods both times.

Does anyone know how to use strings to find the framework that is redefining addTarget:action:forEvents?

Any help would be greatly appreciated!!

Thanks,
Doug
dougdrury is offline   Reply With Quote
Old 01-17-2011, 03:35 PM   #2 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 55
listingboat is on a distinguished road
Default

Are you specifically searching for "addTarget:action:forEvents"? Because you won't find anything that way as the declaration for this method will include data type specifications and passed variable declarations.

For instance, it would look like:

Code:
- (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents
It's also weird that it specifies "forEvents" when this method for the UIControl class is "forControlEvents".

Try just searching for "addTarget".

Last edited by listingboat; 01-17-2011 at 03:37 PM. Reason: added [code]
listingboat is offline   Reply With Quote
Old 01-17-2011, 03:52 PM   #3 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by listingboat View Post
Are you specifically searching for "addTarget:action:forEvents"? Because you won't find anything that way as the declaration for this method will include data type specifications and passed variable declarations.

For instance, it would look like:

Code:
- (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents
It's also weird that it specifies "forEvents" when this method for the UIControl class is "forControlEvents".

Try just searching for "addTarget".
The UIControl method is public. I believe it's addTarget:action:forEvents: thats private.

I agree. Try searching for "addTarget:" or "forEvents:"

In general, if you use a method and the compiler warns you that the target object may not respond to that message, you might be in trouble. Either your program is going to crash at runtime, you're calling a method inside one of your objects that you didn't put in the interface, or you're calling a non-public method of a system framework.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 01-17-2011, 04:05 PM   #4 (permalink)
Registered Member
iPhone Dev SDK Supporter
 
Join Date: Jan 2009
Location: California
Posts: 40
dougdrury is on a distinguished road
Default Found it! - addTarget:action:forEvents

Thanks Guys!!
I did a search in project for 'addTarget' and found it! Now I don't know what is wrong:

Here is my code:
Code:
UIButton *myButton = [[UIButton alloc] initWithFrame:CGRectMake(0,0,320,480)];

[myButton addTarget:self
	action:@selector(didSelectAdvert:) 
	forEvents:UIControlEventTouchUpInside];
I am just adding a target to a button (over a view) that dismisses a modalViewController. Is there a better way to do this without angering the Gods of Apple? ;-)

Thanks for anything!!

Last edited by dougdrury; 01-17-2011 at 04:10 PM.
dougdrury is offline   Reply With Quote
Old 01-17-2011, 04:11 PM   #5 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by dougdrury View Post
Thanks Guys!!
I did a search in project for 'addTarget' and found it! Now I don't know what is wrong:

Here is my code:
Code:
UIButton *myButton = [[UIButton alloc] initWithFrame:CGRectMake(0,0,320,480)];

	[myButton addTarget:self
				  action:@selector(didSelectAdvert:) 
			   forEvents:UIControlEventTouchUpInside];
I am just adding a target to a button (over a view) that dismisses a modalViewController. Is there a better way to do this without angering the Gods of Apple? ;-)

Thanks for anything!!

Ok, search the XCode docs for addTarget:action:forEvents. Can you find such a method?


If not, search the XCode docs for "addTarget:" and look for similar-named methods. You should only see 2 under the "API" results group. One of them is what you want, and it was already mentioned by me and another poster.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 01-17-2011, 04:20 PM   #6 (permalink)
Registered Member
iPhone Dev SDK Supporter
 
Join Date: Jan 2009
Location: California
Posts: 40
dougdrury is on a distinguished road
Default

Duncan,
I appreciate your input and your patience. I see what you are saying. And I see the methods in the docs.

I thought I was just using these methods to do something, not redefining them.

Forgive my ignorance, but I don't know how I am overriding the private API by calling what I think is just an objective-c method provided by apple.

Sorry, but could you explain how I am redefining the method in my code below? I am not trying to be obtuse. I am just trying to figure out how my code is redefining versus just using the method.

Code:
- (void)viewDidLoad {
    [super viewDidLoad];

.
.
.	
	UIImage* image = [UIImage imageWithData: [NSData dataWithContentsOfURL:url]];
	UIImageView *imageview = [[UIImageView alloc] initWithImage: image];

	[self.view addSubview:imageview];
	
	UIButton *myButton = [[UIButton alloc] initWithFrame:CGRectMake(0,0,320,480)];

	[myButton addTarget:self
		action:@selector(didSelectAdvert:) 
		forEvents:UIControlEventTouchUpInside];
	
	[self.view insertSubview:myButton aboveSubview:imageview];	
}

- (void) didSelectAdvert:(id)sender{
	[self dismissModalViewControllerAnimated: YES];
}
Thanks for any input. I do appreciate it!!!!!!
Doug
dougdrury is offline   Reply With Quote
Old 01-17-2011, 04:25 PM   #7 (permalink)
Registered Member
iPhone Dev SDK Supporter
 
Join Date: Jan 2009
Location: California
Posts: 40
dougdrury is on a distinguished road
Default

Oh! Do I just change

Code:
[myButton addTarget:self
	action:@selector(didSelectAdvert:) 
	forEvents:UIControlEventTouchUpInside];
to

Code:
[myButton addTarget:self
	action:@selector(didSelectAdvert:) 
	forControlEvents:UIControlEventTouchUpInside];
Am I redefining a method within addTarget:action by calling forEvents instead of forControlEvents?

Thanks,
Doug
dougdrury is offline   Reply With Quote
Old 01-17-2011, 04:27 PM   #8 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by dougdrury View Post
Duncan,
I appreciate your input and your patience. I see what you are saying. And I see the methods in the docs.

I thought I was just using these methods to do something, not redefining them.

Forgive my ignorance, but I don't know how I am overriding the private API by calling what I think is just an objective-c method provided by apple.

Sorry, but could you explain how I am redefining the method in my code below? I am not trying to be obtuse. I am just trying to figure out how my code is redefining versus just using the method.

Code:
- (void)viewDidLoad {
    [super viewDidLoad];

.
.
.	
	UIImage* image = [UIImage imageWithData: [NSData dataWithContentsOfURL:url]];
	UIImageView *imageview = [[UIImageView alloc] initWithImage: image];

	[self.view addSubview:imageview];
	
	UIButton *myButton = [[UIButton alloc] initWithFrame:CGRectMake(0,0,320,480)];

	[myButton addTarget:self
		action:@selector(didSelectAdvert:) 
		forEvents:UIControlEventTouchUpInside];
	
	[self.view insertSubview:myButton aboveSubview:imageview];	
}

- (void) didSelectAdvert:(id)sender{
	[self dismissModalViewControllerAnimated: YES];
}
Thanks for any input. I do appreciate it!!!!!!
Doug
Dude, you got the method name wrong. It's not addTarget:action:forEvents: It's something close to, but not quite, that.

The method you want is in UIControl. Find it, and figure out what's different about your method name.

You need to figure this out for yourself. Look at the docs carefully. Look for a method that's really close to that name, but slightly different. Look at every single character of the method name, one at a time. The official method name and your code are different.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 01-17-2011, 04:32 PM   #9 (permalink)
Registered Member
iPhone Dev SDK Supporter
 
Join Date: Jan 2009
Location: California
Posts: 40
dougdrury is on a distinguished road
Default

Duncan,
It is clear now!!

I really appreciate your replies. If the compiler would have thrown something like 'Dude, you got the method name wrong' then I would have gotten it.

Thanks again. You rock!!

Doug
dougdrury is offline   Reply With Quote
Reply

Bookmarks

Tags
app store, otool, reject, rejected, strings

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
» Online Users: 366
10 members and 356 guests
7twenty7, blueorb, dre, iAppDeveloper, iGamesDev, Mah6447, Morrisone, mottdog, sacha1996, Touchmint
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,667
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, host number one
Powered by vBadvanced CMPS v3.1.0

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