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 11-19-2009, 07:57 PM   #1 (permalink)
Registered Member
 
Join Date: Mar 2009
Location: Austin, TX
Posts: 67
Default App got rejected... need a new way to do this.

So My app was rejected (it has been approved every other time i have put it in for review and I hadn't touched this code path in ages)
so It got rejected for this line
Code:
	[myAlert addTextFieldWithValue:nil label:NSLocalizedString(@"Name",@"Name")];
Apparently addTextFieldWithValue:nil label:
is a private API...
so HOW THE HELL are we suppose to put a UITextField inside an AlertView?!

Can someone help?
Thank you
-K
__________________
--------------------------------------------------------------
Applications:
Tap Dat! - Become a Tapping Fiend and compete with people around the world!
www.batlin-solutions.com
batlin is offline   Reply With Quote
Old 11-19-2009, 07:59 PM   #2 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,072
Default

UIAlertView inherits from UIView. addSubview.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 11-19-2009, 08:02 PM   #3 (permalink)
Will Work for Food!
 
itzdark's Avatar
 
Join Date: Apr 2009
Posts: 579
Send a message via AIM to itzdark Send a message via MSN to itzdark
Default

Quote:
Originally Posted by BrianSlick View Post
UIAlertView inherits from UIView. addSubview.
in other words, [myAlertView addSubview:myTextField];
__________________

Check out my apps

Developers, check out study buddy. I use it everytime I code. It's great for those late night coding sessions.
Unofficial Ad Hoc Distribution Guide || Join my cooperative ad hoc testing group
iSoothe Promotional Video
Contact Me
itzdark is offline   Reply With Quote
Old 11-19-2009, 08:06 PM   #4 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 211
Default

Quote:
Originally Posted by batlin View Post
So My app was rejected (it has been approved every other time i have put it in for review and I hadn't touched this code path in ages)
so It got rejected for this line
Code:
	[myAlert addTextFieldWithValue:nil label:NSLocalizedString(@"Name",@"Name")];
Apparently addTextFieldWithValue:nil label:
is a private API...
so HOW THE HELL are we suppose to put a UITextField inside an AlertView?!

Can someone help?
Thank you
-K
How were they able to tell that your code used a private API? You can do that with only public APIs, so how would they know that your app is not using those? Are they tearing apart our submitted apps' binaries, looking for such things?

Here's how you can do that with public apis:
Code:
UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Enter your zip code:" message:@"this gets covered by text field" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Search", nil];
	UITextField *myTextField = [[UITextField alloc] init];
	//[myTextField setBackgroundColor:[UIColor whiteColor]];
	myTextField.delegate = self;
	myTextField.opaque = YES;
	myTextField.borderStyle = UITextBorderStyleRoundedRect;
	myTextField.frame = CGRectMake(100, 45, 80, 25.0); //make this bigger if need be. I needed it small
	myTextField.textAlignment = UITextAlignmentCenter;
	myTextField.keyboardType = UIKeyboardTypeNumberPad; //change keyboard type, too
	myTextField.returnKeyType = UIReturnKeyDone;
	[myTextField becomeFirstResponder];
	[myAlertView addSubview:myTextField];
	[myTextField release];
	CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 130.0);
	[myAlertView setTransform:myTransform];
	[myAlertView show];
	[myAlertView release];
__________________
www.thomashuntington.com

Political GPS - Track your Congress and Find Yourself.
Apple New and Noteworthy

Nightstand Central - Music Alarm Clock with Weather, Photos, and Sleep Timer
Apple Staff Favorite - Top 10 iPhone Paid Productivity, Top 5 Free iPad Overall
csnplt is offline   Reply With Quote
Old 11-19-2009, 08:11 PM   #5 (permalink)
Will Work for Food!
 
itzdark's Avatar
 
Join Date: Apr 2009
Posts: 579
Send a message via AIM to itzdark Send a message via MSN to itzdark
Default

Quote:
Originally Posted by csnplt View Post
How were they able to tell that your code used a private API? You can do that with only public APIs, so how would they know that your app is not using those? Are they tearing apart our submitted apps' binaries, looking for such things?
Undocumented APIs throw warnings dont they??? or atleast the ones ive used have.
Apple decompiles the binary you send them so they can see your code... sometimes this stuff must just slip through
__________________

Check out my apps

Developers, check out study buddy. I use it everytime I code. It's great for those late night coding sessions.
Unofficial Ad Hoc Distribution Guide || Join my cooperative ad hoc testing group
iSoothe Promotional Video
Contact Me
itzdark is offline   Reply With Quote
Old 11-19-2009, 08:14 PM   #6 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: New Zealand
Posts: 189
Default

They must of just started scanning, because up until this point I've
had no problems. This morning I received this:

...Unfortunately it cannot be added to the App Store because it is using private APIs. Use of non-public APIs, which as outlined in the iPhone Developer Program License Agreement section 3.3.1 is prohibited:

"3.3.1 Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs."

The following non-public APIs are included in your application:
addTextFieldWithValue:label:
textFieldAtIndex:
LemonMeringue is offline   Reply With Quote
Old 11-19-2009, 08:47 PM   #7 (permalink)
Web & Software Developer
 
Join Date: Nov 2009
Posts: 94
Default

If they are taking the time to sniff through each line of code maybe that's why they take so long to approve apps?
RyanW is offline   Reply With Quote
Old 11-19-2009, 10:02 PM   #8 (permalink)
Registered Member
 
Join Date: Mar 2009
Location: Austin, TX
Posts: 67
Default

Quote:
Originally Posted by RyanW View Post
If they are taking the time to sniff through each line of code maybe that's why they take so long to approve apps?
Thanks all for the replies,
I have already tried the addSubView.. and it doesnt exactly do what I like..
what it does is it shows the Title of the AlertView but the body of the alert view gets covered up by the UITextField? I have tried to modify the frame of the AlertView with no luck...

Code:
UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Congratulations",@"Congrats Title") 
                                                      message:NSLocalizedString(@"You scored in the top 5!",@"Local leaderboard title")  
                                                     delegate:self 
                                            cancelButtonTitle:NSLocalizedString(@"Cancel","@Cancel") 
                                            otherButtonTitles:NSLocalizedString(@"Ok",@"Ok"), nil];
    myAlert.frame = CGRectMake( 0, 0, 300, 260);
    UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 55.0)];
    [myTextField setBackgroundColor:[UIColor whiteColor]];
    [myAlert addSubview:myTextField];
    CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 75.0);
    [myAlert setTransform:myTransform];
    [myAlert show];
    [myAlert release];
I don't know how to attach pictures here but If I could it would show how on the way I did it (private way) it showed a Title, Message AND a textfield but with the add subview it only shows the title and textfield.. make sense?


Thank you all!
-K
__________________
--------------------------------------------------------------
Applications:
Tap Dat! - Become a Tapping Fiend and compete with people around the world!
www.batlin-solutions.com
batlin is offline   Reply With Quote
Old 11-19-2009, 10:04 PM   #9 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,072
Default

Add a couple \n to the end of the message.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 11-19-2009, 10:06 PM   #10 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: New Zealand
Posts: 189
Default

UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"Congratulations!!"
message:@"\n\nPlease enter your name.\n"
delegate: self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK",nil];
LemonMeringue is offline   Reply With Quote
Old 11-20-2009, 08:34 AM   #11 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 62
Default

Quote:
Originally Posted by RyanW View Post
If they are taking the time to sniff through each line of code maybe that's why they take so long to approve apps?
They don't need to sniff through every line of code. I don't think that they can access your source.
What they can see is what parts of the iPhone API are invoked. You can easily get this information with Instruments for example or any debugger.
ff10 is offline   Reply With Quote
Old 11-20-2009, 10:35 AM   #12 (permalink)
Registered Member
 
Join Date: Mar 2009
Location: Austin, TX
Posts: 67
Default

Quote:
Originally Posted by BrianSlick View Post
Add a couple \n to the end of the message.

YOU ARE AWESOME!
Thank you.. that did it.. here is my code for anyone that is curious...

Code:
UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Congratulations!",@"Congrats Title") 
                                                      message:@"You scored in the top 5!\n\n"  
                                                     delegate:self 
                                            cancelButtonTitle:NSLocalizedString(@"Cancel","@Cancel") 
                                            otherButtonTitles:NSLocalizedString(@"Ok",@"Ok"), nil];
    myAlert.frame = CGRectMake( 0, 0, 300, 260);
    UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(32.0, 65.0, 220.0, 25.0)];
    [myTextField setBackgroundColor:[UIColor whiteColor]];
    myTextField.placeholder = @"Your Name";
    myTextField.borderStyle = UITextBorderStyleRoundedRect;
    myTextField.backgroundColor = [UIColor blackColor];
    myTextField.delegate = self;
    myTextField.tag = 1;
    [myAlert addSubview:myTextField];
    CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 75.0);
    [myAlert setTransform:myTransform];
    [myAlert show];
    [myAlert release];
__________________
--------------------------------------------------------------
Applications:
Tap Dat! - Become a Tapping Fiend and compete with people around the world!
www.batlin-solutions.com
batlin is offline   Reply With Quote
Old 11-20-2009, 04:00 PM   #13 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,534
Send a message via ICQ to smithdale87 Send a message via AIM to smithdale87 Send a message via Skype™ to smithdale87
Default

Quote:
Undocumented APIs throw warnings dont they??? or atleast the ones ive used have.
They do throw warnings, but that's just because the compiler doesn't know the method exists. All you have to do is define the methods in a header file, and the warnings will go away.
smithdale87 is offline   Reply With Quote
Old 11-21-2009, 03:36 PM   #14 (permalink)
Senior member
 
Join Date: May 2009
Location: Lille, France
Posts: 34
Default

Quote:
Originally Posted by smithdale87 View Post
They do throw warnings, but that's just because the compiler doesn't know the method exists. All you have to do is define the methods in a header file, and the warnings will go away.
how does apple know you used this function instead of anotheir ?

I don't know the apple/iphone linkage or dynamic library so my opinion is based on experience of other system : if I have to test an application which I only have the binary, and this application is using dynamic library; I add a special mode or a proxy for those library to know which library is used and in librabry which function is used

I would not be surprised that apple have, for every function in library, a call to a generic trace function while entering and quitting every function (*). Then the amount of work to check if you are using some undocumented function is 'nil'

I don't know if I made it clear to understand

greg

(*) sound to be a lot of work, but when you debug a huge project, using many people work, it's a great help to read this trace (indented...) to find which function has been called before.
Gregoire is offline   Reply With Quote
Old 11-22-2009, 05:51 AM   #15 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 791
Default

It should be pretty easy to spot private API usage (assuming they test every part of your application). In the end its their implementation, you can't use it undetected.
They could have a #define PRIVATE_API_SEARCH and each method will have a #ifdef PRIVATE_API_SEARCH NSLog(@"PRIVATE API USAGE DETECTED <<<<<");
nobre84 is offline   Reply With Quote
Old 11-23-2009, 04:42 PM   #16 (permalink)
Registered Member
 
Join Date: Nov 2009
Location: Adelaide, Australia
Posts: 8
Default

Well chalk me up as rejected for the same. So stupid, I completely forgot about that line. Thanks for the example code guys.
greendestiny is offline   Reply With Quote
Old 11-23-2009, 06:49 PM   #17 (permalink)
Registered Member
 
Join Date: Mar 2009
Location: Austin, TX
Posts: 67
Default

Quote:
Originally Posted by greendestiny View Post
Well chalk me up as rejected for the same. So stupid, I completely forgot about that line. Thanks for the example code guys.
Looks like they are getting a little more stingy on the private APIs what use to get though doesn't now
__________________
--------------------------------------------------------------
Applications:
Tap Dat! - Become a Tapping Fiend and compete with people around the world!
www.batlin-solutions.com
batlin is offline   Reply With Quote
Old 11-24-2009, 03:18 PM   #18 (permalink)
Registered Member
 
Join Date: Oct 2009
Location: Belfast, Northern Ireland
Posts: 36
Send a message via AIM to materialised Send a message via MSN to materialised Send a message via Yahoo to materialised
Default

Quote:
Originally Posted by greendestiny View Post
Well chalk me up as rejected for the same. So stupid, I completely forgot about that line. Thanks for the example code guys.
Ditto
materialised is offline   Reply With Quote
Old 11-24-2009, 03:29 PM   #19 (permalink)
Registered Member
 
Join Date: Oct 2009
Location: Belfast, Northern Ireland
Posts: 36
Send a message via AIM to materialised Send a message via MSN to materialised Send a message via Yahoo to materialised
Default

Quote:
Originally Posted by batlin View Post
YOU ARE AWESOME!
Thank you.. that did it.. here is my code for anyone that is curious...

Code:
UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Congratulations!",@"Congrats Title") 
                                                      message:@"You scored in the top 5!\n\n"  
                                                     delegate:self 
                                            cancelButtonTitle:NSLocalizedString(@"Cancel","@Cancel") 
                                            otherButtonTitles:NSLocalizedString(@"Ok",@"Ok"), nil];
    myAlert.frame = CGRectMake( 0, 0, 300, 260);
    UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(32.0, 65.0, 220.0, 25.0)];
    [myTextField setBackgroundColor:[UIColor whiteColor]];
    myTextField.placeholder = @"Your Name";
    myTextField.borderStyle = UITextBorderStyleRoundedRect;
    myTextField.backgroundColor = [UIColor blackColor];
    myTextField.delegate = self;
    myTextField.tag = 1;
    [myAlert addSubview:myTextField];
    CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 75.0);
    [myAlert setTransform:myTransform];
    [myAlert show];
    [myAlert release];
How do you read the value of the textfield in the Alert Delegate?

Kind Regards
materialised is offline   Reply With Quote
Old 11-24-2009, 11:58 PM   #20 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,072
Default

Quote:
Originally Posted by materialised View Post
How do you read the value of the textfield in the Alert Delegate?

Kind Regards
Make a @property for the textfield.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 02-06-2010, 06:00 PM   #21 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 1
Default

Sorry for the old bump, but I registered just to say thank you for this snippet. Got the same rejection from Apple and this made it easy for me to fix.

Looking around, this looks like a great community. I'll be sticking around
Idlemedia is offline   Reply With Quote
Old 02-06-2010, 08:08 PM   #22 (permalink)
Registered Member
 
Join Date: Jul 2008
Posts: 355
Default

Quote:
Originally Posted by csnplt View Post
How were they able to tell that your code used a private API? You can do that with only public APIs, so how would they know that your app is not using those? Are they tearing apart our submitted apps' binaries, looking for such things?
App Store reviewers run every app through static code analysis tools during review as of a couple of months ago. The problem is they really don't know what they're doing with them.
There was one guy who's app got rejected for using a private API, which he contested. Turned out it was one Apple's own classes calling the private API.
Bucky is offline   Reply With Quote
Old 02-06-2010, 08:59 PM   #23 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 166
Default

Quote:
Originally Posted by csnplt View Post
How were they able to tell that your code used a private API? You can do that with only public APIs, so how would they know that your app is not using those? Are they tearing apart our submitted apps' binaries, looking for such things?

Here's how you can do that with public apis:
Code:
UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Enter your zip code:" message:@"this gets covered by text field" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Search", nil];
	UITextField *myTextField = [[UITextField alloc] init];
	//[myTextField setBackgroundColor:[UIColor whiteColor]];
	myTextField.delegate = self;
	myTextField.opaque = YES;
	myTextField.borderStyle = UITextBorderStyleRoundedRect;
	myTextField.frame = CGRectMake(100, 45, 80, 25.0); //make this bigger if need be. I needed it small
	myTextField.textAlignment = UITextAlignmentCenter;
	myTextField.keyboardType = UIKeyboardTypeNumberPad; //change keyboard type, too
	myTextField.returnKeyType = UIReturnKeyDone;
	[myTextField becomeFirstResponder];
	[myAlertView addSubview:myTextField];
	[myTextField release];
	CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 130.0);
	[myAlertView setTransform:myTransform];
	[myAlertView show];
	[myAlertView release];
Where have you been for the last month. Yes, they are analysing the binaries we submit for private APIs, not something that is particularly complicated to do.
cakesy is offline   Reply With Quote
Old 05-15-2010, 03:49 PM   #24 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 29
Default

Hey,

sorry for pushing this thread. I have the same problem and already solved it with your solution.
Just one more thing: It's necessary that the entered text get's shown in an UILabel. Do you know how I can do this?

Already thank you
sn0w911 is offline   Reply With Quote
Old 05-15-2010, 03:51 PM   #25 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,072
Default

Get the text from the text field, give it to the label.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick 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
» Online Users: 467
12 members and 455 guests
dana0550, dapis, darbsllim, Domele, dre, EdwardMichel, Harolano, HowEver, ilmman, lbert, marshusensei, Objective Zero
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 157,851
Threads: 88,914
Posts: 379,296
Top Poster: BrianSlick (7,072)
Welcome to our newest member, darbsllim
Powered by vBadvanced CMPS v3.1.0

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