这个黑客会不会让苹果大发雷霆? (拒绝我的应用程序吗?)

时间:2009-11-19 06:30:44

标签: iphone xcode cocoa-touch

我从

获取了这段代码

Changing the background color of a UIAlertView?

UIAlertView *theAlert = [[[UIAlertView alloc] initWithTitle:@"Atention"
   message: @"YOUR MESSAGE HERE", nil)
   delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];

   [theAlert show];

   UILabel *theTitle = [theAlert valueForKey:@"_titleLabel"];
   [theTitle setTextColor:[UIColor redColor]];

   UILabel *theBody = [theAlert valueForKey:@"_bodyTextLabel"];
   [theBody setTextColor:[UIColor blueColor]];

   UIImage *theImage = [UIImage imageNamed:@"Background.png"];    
   theImage = [theImage stretchableImageWithLeftCapWidth:16 topCapHeight:16];
   CGSize theSize = [theAlert frame].size;

   UIGraphicsBeginImageContext(theSize);    
   [theImage drawInRect:CGRectMake(0, 0, theSize.width, theSize.height)];    
   theImage = UIGraphicsGetImageFromCurrentImageContext();    
   UIGraphicsEndImageContext();

   [[theAlert layer] setContents:[theImage CGImage]];

由oxigen发布。

我不确定我是否应该在我的应用中使用此代码。苹果是否会对此黑客有任何疑问(他们会拒绝该应用吗?)

3 个答案:

答案 0 :(得分:10)

下划线作为您正在访问的属性的前缀(_titleLabel,_bodyTextLabel)清楚地表明这些是私有属性,不应该被修改。 Apple最近开始扫描所有提交的二进制文件以访问私有方法和属性,这些值在您的应用程序中自行应该足以让您被拒绝。使用私有API,拒绝或拒绝不是一个好主意,因为它们通常是私有的,并且可能会因未来的操作系统更新而破坏您的应用程序。

此外,您通过更改提醒颜色违反了iPhone Human Interface Guidelines

  

您可以指定文字,数字   按钮和按钮内容   警报,但你无法自定义   警报的背景外观   本身。

再次,来自iPhone Human Interface Guidelines

  

因为用户习惯了   这些的外观和行为   观点,使用它们很重要   一贯正确地在你的   应用

答案 1 :(得分:2)

只有Apple可以回答这个问题。他们不会回答,直到你提交并等待大约2周。

如果您确实需要它并且有2周时间可以杀死,请尝试提交。但它可能会在稍后的更新中被拒绝。

您是否在使用任何未记录的API?如果你是,假设它会被拒绝。如果你不是,但你正在做一些不同的事情,那么你问题的唯一答案就是“我不知道”。

答案 2 :(得分:0)

如果您想知道某些编程技术是否会导致拒绝,请制作一个功能有限的小应用,并在其中使用您可疑的技术。

获得答案需要2周时间,但至少你不会预先投入大量时间。

如果他们批准您的测试应用,请将其从商店中删除。如果它具有真正的实用性,请将价格设置为0.99美元并保留。

这种方法并非万无一失,但成本低廉。