GameCenter Matchmaking 을 위한 Checklist
@required
1. 현재 user 인증
2. MatchMaking User Interface
3. Handle invitation from other user
@optional
1. Programmatcially Match find 코드 삽입
2. Advanced Match Making 코드 삽입
UIKIT_EXTERN NSString *NSStringFromCGPoint(CGPoint point); UIKIT_EXTERN NSString *NSStringFromCGSize(CGSize size); UIKIT_EXTERN NSString *NSStringFromCGRect(CGRect rect); UIKIT_EXTERN NSString *NSStringFromCGAffineTransform(CGAffineTransform transform); UIKIT_EXTERN NSString *NSStringFromUIEdgeInsets(UIEdgeInsets insets); UIKIT_EXTERN NSString *NSStringFromUIOffset(UIOffset offset);
NSLog(@"%f,%f,%f,%f,",rect.origin.x,rect.origin.y,rect.size.width,rect.size.height);
2011-11-24 15:29:40.397 App[9981:f803] -[AppView layoutSubviews],33th - currenctRect = {{14, 20}, {768, 1024}}
public Problem parseXML(XmlResourceParser xmlParser) throws Exception { Problem problem = new Problem(); String name = null; while (xmlParser.getEventType() != XmlPullParser.END_DOCUMENT) { if (xmlParser.getEventType() == XmlPullParser.START_TAG) { name = xmlParser.getName(); } else if (xmlParser.getEventType() == XmlPullParser.TEXT) { if (name == null) { Log.d("ProblemDAO-parseXML", "name is null ? error ??"); } } else if (xmlParser.getEventType() == XmlPullParser.END_TAG) { name = null; } xmlParser.next(); } return problem; }
if(name.equalsIgnoreCase("title") == true) { }위와 같은 코드의 문제점은 if/elseif/elseif 지옥이 나타난다는것이죠. :(
char[] stringArray = name.toCharArray(); stringArray[0] = Character.toUpperCase(stringArray[0]); String methodName = "set"+ new String(stringArray); try { Method m = Problem.class.getMethod(methodName, String.class); m.invoke(problem, text); } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); Method m = Problem.class.getMethod(methodName,Integer.class); m.invoke(problem,Integer.valueOf(text)); }
facebook sdk 의 github 소개페이지
UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 0, 160, 100)]; [pickerView setDataSource:self]; [pickerView setDelegate:self]; [self.view addSubview:pickerView]; [pickerView release];
iOS 4.3 Simulator
iOS5 Simlurator
ACAccountStore *store = [[ACAccountStore alloc] init];
ACAccountType *twitterType = [store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[store requestAccessToAccountsWithType:twitterType
withCompletionHandler:^(BOOL granted, NSError *error) {
if(granted){
//accessgranted !
NSLog(@"granted = %d",granted);
NSArray *accounts = [store accountsWithAccountType:twitterType];
NSLog(@"accounts = %@", accounts);
}
}];
[store release];
2011-10-14 16:34:07.600 TwitterTest[3364:12103] accounts = (
"type:com.apple.twitter\nidentifier: 527A4FE0-FBAA-40A1-A7C8-C6FA2EEE9698\naccountDescription: @liketaehoon\nusername: liketaehoon\nobjectID: x-coredata://0102DFCE-5B1C-438B-B14B-D9BB471DD885/Account/p2\nenabledDataclasses: {(\n)}\nproperties: {\n \"user_id\" = 48573923;\n}\nparentAccount: (null)\nowningBundleID:com.apple.Preferences"
)
ACAccount *account = [[ACAccount alloc] initWithAccountType:twitterType];
ACAccountCredential *oauthCredential = [[ACAccountCredential alloc] initWithOAuthToken:token
tokenSecret:secret]; [accountStore saveAccount:account withCompletionHandler:^(BOOL success,
account.credential = oauthCredential; NSError *error) {
if (success) {
//account validated and saved
} else {
//save failed, handle your errors! !}
}];
[oauthCredential release];
[account release];
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
TWTweetComposeViewController *viewController = [[TWTweetComposeViewController alloc] init];
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.window.rootViewController = viewController;
[viewController release];
[self.window makeKeyAndVisible];
return YES;
}
*** Terminating app due to uncaught exception 'TWUnsupportedPresentationException', reason: 'TWTweetComposeViewController cannot currently be used within a popover or as a non-modal view controller'
*** First throw call stack:
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
TWTweetComposeViewController *composeViewController = [[TWTweetComposeViewController alloc] init];
[self presentModalViewController:composeViewController animated:YES];
[composeViewController release];
}
// Sets the initial text to be tweeted. Returns NO if the specified text will
// not fit within the character space currently available, or if the sheet
// has already been presented to the user.
- (BOOL)setInitialText:(NSString *)text;
// Adds an image to the tweet. Returns NO if the additional image will not fit
// within the character space currently available, or if the sheet has already
// been presented to the user.
- (BOOL)addImage:(UIImage *)image;
// Removes all images from the tweet. Returns NO and does not perform an operation
// if the sheet has already been presented to the user.
- (BOOL)removeAllImages;
// Adds a URL to the tweet. Returns NO if the additional URL will not fit
// within the character space currently available, or if the sheet has already
// been presented to the user.
- (BOOL)addURL:(NSURL *)url;
// Removes all URLs from the tweet. Returns NO and does not perform an operation
// if the sheet has already been presented to the user.
- (BOOL)removeAllURLs;
// Specify a block to be called when the user is finished. This block is not guaranteed
// to be called on any particular thread.
@property (nonatomic, copy) TWTweetComposeViewControllerCompletionHandler completionHandler;
while([composeViewController addImage:[UIImage imageNamed:@"circle"]] == YES) {
NSLog(@"abcdefg");
}
이런식으로 코딩을 했을때, "abcdefg"가 한번만 호출되는것으로 봐서, 중복체크도 해주는 모양입니다.
UIKIT_CLASS_AVAILABLE(5_0) @interface TWTweetComposeViewController : UIViewController {
}
// Returns if Twitter is accessible and at least one account has been setup.
+ (BOOL)canSendTweet;