使用Xcode4.2发布支持armv6平台的应用

苹果对xcode进行了升级到4.2 ,接着又对Application Loader的App应用自动validate做了升级,由于xcode4.2默认使用的架构是armv7,如果应用需要支持4.3以下的系统, 那么发布的时候苹果就会一个蛋疼的错误。

 

iPhone / iPod touch : application executable is missing a required architecture. Atleast one of the following architectures must be present: armv6

 

解决的办法当然是让应用支持armv6。直接在Architectures中添加 armv6。正常情况下就可以解决这个问题了。没有必要做其它工作的。

如果使用的是Three20的框架。那么正常情况下会报一大堆的编译错误。链接错误。因为这个时候Thre20的编译使用的架构仍然是armv7,所以需要在xcode的左侧侧边栏一一打开添加armv6架构。

最近上传的时候苹果还会拼命告诉你Icon图标它找不到,即使你设置了icon.png的所有的配置文件,但是它仍然会非常固执的告诉你真的没有。之前的上传是正常的。所以我把icon压缩的选项关闭的了。这样才能够成功上传。



Share
Posted in apps, bookcamp, iphone at February 4th, 2012. No Comments.

当苹果审核遇到 invalid binary 的解决办法

上传碰到invalid binary,网络上提供很多方法。但是其实最重要的方法就是查看email。还是写下几点要注意的

1,上传Icon资源文件是否正确

2,Entitlements.pllist文件是否正确

3,上传binary中有私有API

最后一点其实最重要的,但是包括stackoverflow在内的网站都告诉你可能是Icon错误。这个时候要去查看email。苹果并不会在itunesconnect中给你答案。

Share
Posted in iphone, Uncategorized at November 15th, 2011. 1 Comment.

how to use TTAreaStyle to create label style with icon

 

TTAreaStyle is a utility style class depend on three20.(please follow this link ttareastyleforthree20 ) It enhances the style of three20 for it could create an independent rect for other styles drawn on it. You can create some more complex style for TTView .Such as , a label with a icon in the front of it or a view with separated segments with different style. for example ,look at the imgs showed below.



usually , we may be adopt the method  creating a view with a UIImageView and a Label added to it . when there is a single exception , for saving time ,we feel free to use it . Honestly and personally , I have to say , it is a ugly method .I was thinking , is there any cheap way to implement it . The style of Three20 make it achievable. All you want to do just is appending a style to a view inherited from TTView. Here , I used TTLable.



- (TTLabel*)authorLabel {
if (!_authorLabel) {
_authorLabel = [[TTLabel alloc] initWithFrame:CGRectMake(0, 0, self.width - 2 * BookSummaryViewMargin, 0)];
_authorLabel.style = TTSTYLE(bookSummaryAuthorStyle);
_authorLabel.backgroundColor = [UIColor clearColor];
[self addSubview:_authorLabel];
}
return _authorLabel;
}



In the Global stylesheet  , adding this,



-(TTStyle*) bookSummaryAuthorStyle{
CGFloat timeIconWidth = 10;
CGFloat timeIconHeight = 12;
return
[TTAreaStyle styleWithBlock:^(CGRect rect ,id data){
return CGRectMake(0, (CGRectGetHeight(rect) - [[data objectAtIndex:0] floatValue]) / 2 , 10, 12);
}
data:[NSArray arrayWithObjects:[NSNumber numberWithFloat:timeIconWidth],
[NSNumber numberWithFloat:timeIconHeight],nil]
style:
[TTImageStyle styleWithImageURL:@"bundle://time.png" next:nil]
next:
[TTBoxStyle styleWithPadding:UIEdgeInsetsMake(0, 20, 0, 0) next:
[TTTextStyle styleWithFont: [UIFont systemFontOfSize:14]
color: RGBCOLOR(128,128,128)
minimumFontSize: 0
shadowColor: RGBCOLOR(171,171,171)
shadowOffset: TTSTYLEVAR(photoCaptionTextShadowOffset)
textAlignment: UITextAlignmentLeft
verticalAlignment: UIControlContentVerticalAlignmentCenter
lineBreakMode: UILineBreakModeCharacterWrap
numberOfLines: 6
next: nil]]];
}


With TTAreaStyle ,  I creat a independent area which you could draw anything you like . Here , i added 


[TTImageStyle styleWithImageURL:@"bundle://time.png" next:nil]


And then , shrinked  the origin draw area  by using 


[TTBoxStyle styleWithPadding:UIEdgeInsetsMake(0, 20, 0, 0) next:


It's worth nothing that  the param rect in the block wil let you know the size of TTLabel which other style don't offer. It 's a amazing characteristic that help you calculate the position of  elements in the independent area . Off course . do nesting if necessary.


^(CGRect rect ,id data){ }


Share
Posted in iphone at August 29th, 2011. No Comments.

TTStyle的缩进实现

在写一些小的应用时候遇见一个需求,需要在view前面做一个list-type,显然需要一个小缩进,不知到three20有没有其他的解决方案,方正我处理方式是写另一个style。使用方法是这样的。

 [TTSolidFillStyle styleWithColor:color next: [TTAreaStyle styleWithRect:CGRectMake(0, 0, Indent, 18.0) style: [TTLinearGradientFillStyle styleWithColor1:RGBCOLOR(255, 255, 255) color2:RGBCOLOR(0, 0, 0) next:nil] next: [TTBoxStyle styleWithPadding:UIEdgeInsetsMake(0, Indent + Gap, 0, 0) next: [TTTextStyle styleWithFont:nil color:TTSTYLEVAR(linkTextColor) minimumFontSize:14 shadowColor:[UIColor colorWithWhite:255 alpha:0.4] shadowOffset:CGSizeMake(0, -1) textAlignment:UITextAlignmentLeft verticalAlignment:UIControlContentVerticalAlignmentCenter lineBreakMode:UILineBreakModeWordWrap numberOfLines:0 next:nil ]]]]; 

代码如下

//
//  TTAreaStyle.h
//  infzm
//
//  Created by lin waiwai on 1/19/11.
//  Copyright 2011 __waiwai__. All rights reserved.
//

@interface TTAreaStyle : TTStyle {
	CGRect _rect;
	TTStyle *_style;
}

@property (nonatomic, retain) TTStyle*  style;
@property (nonatomic) CGRect rect;

+(TTAreaStyle*)styleWithRect:(CGRect)rect style:(TTStyle*)stylez next:(TTStyle*)next;

@end
//
//  TTAreaStyle.m
//  infzm
//
//  Created by lin waiwai on 1/19/11.
//  Copyright 2011 __waiwai__. All rights reserved.
//

#import "TTAreaStyle.h"

// Core
#import "Three20Core/TTCorePreprocessorMacros.h"

@implementation TTAreaStyle

@synthesize rect  = _rect;
@synthesize style = _style;

///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)dealloc {
	TT_RELEASE_SAFELY(_style);
	[super dealloc];
}

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark Class public

///////////////////////////////////////////////////////////////////////////////////////////////////
+(TTAreaStyle*)styleWithRect:(CGRect)rect style:(TTStyle*)stylez next:(TTStyle*)next; {
	TTAreaStyle* style = [[[self alloc] initWithNext:next] autorelease];
	style.rect = rect;
	style.style = stylez;
	return style;
}

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark TTStyle

///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)draw:(TTStyleContext*)context {

	CGContextRef ctx = UIGraphicsGetCurrentContext();
	CGRect rect = context.frame;
	CGContextSaveGState(ctx);

	[context.shape addToPath:rect];
	CGContextClip(ctx);
	CGContextClipToRect(ctx,self.rect);
	[self.style draw:context];

	CGContextRestoreGState(ctx);

	return [self.next draw:context];
}

@end
Share
Posted in iphone at January 18th, 2011. 2 Comments.