[twitter-dev] Re: iPhone twitter client
It's hard to trouble shoot with a single file. There are many pieces and steps involved to get the entire work flow to work. I write close to 30 pages not including screens to explain it in details. On Jan 18, 9:03 pm, ronnocv ronnocv11223...@gmail.com wrote: I tried to make a twitter client i have an api with 2 files TwitterRequest.h and TwitterRequest.m here is the code for the .m file // // TwitterRequest.m // Chirpie // // Created by Brandon Trebitowski on 6/15/09. // Copyright 2009 __MyCompanyName__. All rights reserved. // #import TwitterRequest.h @implementation TwitterRequest @synthesize username; @synthesize password; @synthesize receivedData; @synthesize delegate; @synthesize callback; @synthesize errorCallback; -(void)friends_timeline:(id)requestDelegate requestSelector: (SEL)requestSelector{ isPost = NO; // Set the delegate and selector self.delegate = requestDelegate; self.callback = requestSelector; // The URL of the Twitter Request we intend to send NSURL *url = [NSURL URLWithString:@http://api.twitter.com/1/statuses/ update.xml]; [self request:url]; } -(void)statuses_update:(NSString *)status delegate:(id)requestDelegate requestSelector:(SEL)requestSelector; { isPost = YES; // Set the delegate and selector self.delegate = requestDelegate; self.callback = requestSelector; // The URL of the Twitter Request we intend to send NSURL *url = [NSURL URLWithString:@http://api.twitter.com/1/statuses/ update.xml]; requestBody = [NSString stringWithFormat:@status=%@,status]; [self request:url]; } -(void)request:(NSURL *) url { theRequest = [[NSMutableURLRequest alloc] initWithURL:url]; if(isPost) { NSLog(@ispost); [theRequest setHTTPMethod:@POST]; [theRequest setValue:@application/x-www-form-urlencoded forHTTPHeaderField:@Content-Type]; [theRequest setHTTPBody:[requestBody dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]]; [theRequest setValue:[NSString stringWithFormat:@%d,[requestBody length] ] forHTTPHeaderField:@Content-Length]; } theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if (theConnection) { // Create the NSMutableData that will hold // the received data // receivedData is declared as a method instance elsewhere receivedData=[[NSMutableData data] retain]; } else { // inform the user that the download could not be made } } - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { //NSLog(@challenged %@,[challenge proposedCredential] ); if ([challenge previousFailureCount] == 0) { NSURLCredential *newCredential; newCredential=[NSURLCredential credentialWithUser:[self username] password:[self password] persistence:NSURLCredentialPersistenceNone]; [[challenge sender] useCredential:newCredential forAuthenticationChallenge:challenge]; } else { [[challenge sender] cancelAuthenticationChallenge:challenge]; // inform the user that the user name and password // in the preferences are incorrect NSLog(@Invalid Username or Password); } } - (void)connection:(NSURLConnection *)connection didReceiveResponse: (NSURLResponse *)response { // this method is called when the server has determined that it // has enough information to create the NSURLResponse // it can be called multiple times, for example in the case of a // redirect, so each time we reset the data. // receivedData is declared as a method instance elsewhere //[receivedData setLength:0]; } - (void)connection:(NSURLConnection *)connection didReceiveData: (NSData *)data { //NSLog([[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]); // append the new data to the receivedData // receivedData is declared as a method instance elsewhere [receivedData appendData:data]; } - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { // release the connection, and the data object [connection release]; // receivedData is declared as a method instance elsewhere [receivedData release]; [theRequest release]; // inform the user NSLog(@Connection failed! Error - %@ %@, [error localizedDescription], [[error userInfo] objectForKey:NSErrorFailingURLStringKey]); if(errorCallback) { [delegate performSelector:errorCallback withObject:error]; } } -
[twitter-dev] Re: iPhone twitter client
I'd like to get feedback on possible webinar on iOS Twitter API. Such as - What are your pain points of integrating Twitter on iOS app? - What are your main problems? - What would you like to achieve using Twitter API on iOS app? Can anyone suggest any good online webinar? learning platform? On Jan 18, 9:03 pm, ronnocv ronnocv11223...@gmail.com wrote: I tried to make a twitter client i have an api with 2 files TwitterRequest.h and TwitterRequest.m here is the code for the .m file // // TwitterRequest.m // Chirpie // // Created by Brandon Trebitowski on 6/15/09. // Copyright 2009 __MyCompanyName__. All rights reserved. // #import TwitterRequest.h @implementation TwitterRequest @synthesize username; @synthesize password; @synthesize receivedData; @synthesize delegate; @synthesize callback; @synthesize errorCallback; -(void)friends_timeline:(id)requestDelegate requestSelector: (SEL)requestSelector{ isPost = NO; // Set the delegate and selector self.delegate = requestDelegate; self.callback = requestSelector; // The URL of the Twitter Request we intend to send NSURL *url = [NSURL URLWithString:@http://api.twitter.com/1/statuses/ update.xml]; [self request:url]; } -(void)statuses_update:(NSString *)status delegate:(id)requestDelegate requestSelector:(SEL)requestSelector; { isPost = YES; // Set the delegate and selector self.delegate = requestDelegate; self.callback = requestSelector; // The URL of the Twitter Request we intend to send NSURL *url = [NSURL URLWithString:@http://api.twitter.com/1/statuses/ update.xml]; requestBody = [NSString stringWithFormat:@status=%@,status]; [self request:url]; } -(void)request:(NSURL *) url { theRequest = [[NSMutableURLRequest alloc] initWithURL:url]; if(isPost) { NSLog(@ispost); [theRequest setHTTPMethod:@POST]; [theRequest setValue:@application/x-www-form-urlencoded forHTTPHeaderField:@Content-Type]; [theRequest setHTTPBody:[requestBody dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]]; [theRequest setValue:[NSString stringWithFormat:@%d,[requestBody length] ] forHTTPHeaderField:@Content-Length]; } theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if (theConnection) { // Create the NSMutableData that will hold // the received data // receivedData is declared as a method instance elsewhere receivedData=[[NSMutableData data] retain]; } else { // inform the user that the download could not be made } } - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { //NSLog(@challenged %@,[challenge proposedCredential] ); if ([challenge previousFailureCount] == 0) { NSURLCredential *newCredential; newCredential=[NSURLCredential credentialWithUser:[self username] password:[self password] persistence:NSURLCredentialPersistenceNone]; [[challenge sender] useCredential:newCredential forAuthenticationChallenge:challenge]; } else { [[challenge sender] cancelAuthenticationChallenge:challenge]; // inform the user that the user name and password // in the preferences are incorrect NSLog(@Invalid Username or Password); } } - (void)connection:(NSURLConnection *)connection didReceiveResponse: (NSURLResponse *)response { // this method is called when the server has determined that it // has enough information to create the NSURLResponse // it can be called multiple times, for example in the case of a // redirect, so each time we reset the data. // receivedData is declared as a method instance elsewhere //[receivedData setLength:0]; } - (void)connection:(NSURLConnection *)connection didReceiveData: (NSData *)data { //NSLog([[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]); // append the new data to the receivedData // receivedData is declared as a method instance elsewhere [receivedData appendData:data]; } - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { // release the connection, and the data object [connection release]; // receivedData is declared as a method instance elsewhere [receivedData release]; [theRequest release]; // inform the user NSLog(@Connection failed! Error - %@ %@, [error localizedDescription], [[error userInfo] objectForKey:NSErrorFailingURLStringKey]); if(errorCallback) {
Re: [twitter-dev] Re: iPhone twitter client
Answers inline. Sent from my iPhone On Jan 19, 2011, at 9:32 AM, Bess bess...@gmail.com wrote: I'd like to get feedback on possible webinar on iOS Twitter API. Such as - What are your pain points of integrating Twitter on iOS app? Launching the iOS simulator takes long. For me that's it. - What are your main problems? None, the twitter API is very easy to understand. - What would you like to achieve using Twitter API on iOS app? Awesomeness. :-) Can anyone suggest any good online webinar? learning platform I'd say dev.twitter.com but that's probably not the best place to learn how to authenticate etc. To learn this I recommend reading the oauth rfc. Tom On Jan 18, 9:03 pm, ronnocv ronnocv11223...@gmail.com wrote: I tried to make a twitter client i have an api with 2 files TwitterRequest.h and TwitterRequest.m here is the code for the .m file // // TwitterRequest.m // Chirpie // // Created by Brandon Trebitowski on 6/15/09. // Copyright 2009 __MyCompanyName__. All rights reserved. // #import TwitterRequest.h @implementation TwitterRequest @synthesize username; @synthesize password; @synthesize receivedData; @synthesize delegate; @synthesize callback; @synthesize errorCallback; -(void)friends_timeline:(id)requestDelegate requestSelector: (SEL)requestSelector{ isPost = NO; // Set the delegate and selector self.delegate = requestDelegate; self.callback = requestSelector; // The URL of the Twitter Request we intend to send NSURL *url = [NSURL URLWithString:@http://api.twitter.com/1/statuses/ update.xml]; [self request:url]; } -(void)statuses_update:(NSString *)status delegate:(id)requestDelegate requestSelector:(SEL)requestSelector; { isPost = YES; // Set the delegate and selector self.delegate = requestDelegate; self.callback = requestSelector; // The URL of the Twitter Request we intend to send NSURL *url = [NSURL URLWithString:@http://api.twitter.com/1/statuses/ update.xml]; requestBody = [NSString stringWithFormat:@status=%@,status]; [self request:url]; } -(void)request:(NSURL *) url { theRequest = [[NSMutableURLRequest alloc] initWithURL:url]; if(isPost) { NSLog(@ispost); [theRequest setHTTPMethod:@POST]; [theRequest setValue:@application/x-www-form-urlencoded forHTTPHeaderField:@Content-Type]; [theRequest setHTTPBody:[requestBody dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]]; [theRequest setValue:[NSString stringWithFormat:@%d,[requestBody length] ] forHTTPHeaderField:@Content-Length]; } theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if (theConnection) { // Create the NSMutableData that will hold // the received data // receivedData is declared as a method instance elsewhere receivedData=[[NSMutableData data] retain]; } else { // inform the user that the download could not be made } } - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { //NSLog(@challenged %@,[challenge proposedCredential] ); if ([challenge previousFailureCount] == 0) { NSURLCredential *newCredential; newCredential=[NSURLCredential credentialWithUser:[self username] password:[self password] persistence:NSURLCredentialPersistenceNone]; [[challenge sender] useCredential:newCredential forAuthenticationChallenge:challenge]; } else { [[challenge sender] cancelAuthenticationChallenge:challenge]; // inform the user that the user name and password // in the preferences are incorrect NSLog(@Invalid Username or Password); } } - (void)connection:(NSURLConnection *)connection didReceiveResponse: (NSURLResponse *)response { // this method is called when the server has determined that it // has enough information to create the NSURLResponse // it can be called multiple times, for example in the case of a // redirect, so each time we reset the data. // receivedData is declared as a method instance elsewhere //[receivedData setLength:0]; } - (void)connection:(NSURLConnection *)connection didReceiveData: (NSData *)data { //NSLog([[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]); // append the new data to the receivedData // receivedData is declared as a method instance elsewhere [receivedData appendData:data]; } - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
Re: [twitter-dev] Re: iPhone twitter client
I'm making an app just like taptweet Sent from my iPod On Jan 19, 2011, at 3:32 AM, Bess bess...@gmail.com wrote: I'd like to get feedback on possible webinar on iOS Twitter API. Such as - What are your pain points of integrating Twitter on iOS app? - What are your main problems? - What would you like to achieve using Twitter API on iOS app? Can anyone suggest any good online webinar? learning platform? On Jan 18, 9:03 pm, ronnocv ronnocv11223...@gmail.com wrote: I tried to make a twitter client i have an api with 2 files TwitterRequest.h and TwitterRequest.m here is the code for the .m file // // TwitterRequest.m // Chirpie // // Created by Brandon Trebitowski on 6/15/09. // Copyright 2009 __MyCompanyName__. All rights reserved. // #import TwitterRequest.h @implementation TwitterRequest @synthesize username; @synthesize password; @synthesize receivedData; @synthesize delegate; @synthesize callback; @synthesize errorCallback; -(void)friends_timeline:(id)requestDelegate requestSelector: (SEL)requestSelector{ isPost = NO; // Set the delegate and selector self.delegate = requestDelegate; self.callback = requestSelector; // The URL of the Twitter Request we intend to send NSURL *url = [NSURL URLWithString:@http://api.twitter.com/1/statuses/ update.xml]; [self request:url]; } -(void)statuses_update:(NSString *)status delegate:(id)requestDelegate requestSelector:(SEL)requestSelector; { isPost = YES; // Set the delegate and selector self.delegate = requestDelegate; self.callback = requestSelector; // The URL of the Twitter Request we intend to send NSURL *url = [NSURL URLWithString:@http://api.twitter.com/1/statuses/ update.xml]; requestBody = [NSString stringWithFormat:@status=%@,status]; [self request:url]; } -(void)request:(NSURL *) url { theRequest = [[NSMutableURLRequest alloc] initWithURL:url]; if(isPost) { NSLog(@ispost); [theRequest setHTTPMethod:@POST]; [theRequest setValue:@application/x-www-form-urlencoded forHTTPHeaderField:@Content-Type]; [theRequest setHTTPBody:[requestBody dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]]; [theRequest setValue:[NSString stringWithFormat:@%d,[requestBody length] ] forHTTPHeaderField:@Content-Length]; } theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if (theConnection) { // Create the NSMutableData that will hold // the received data // receivedData is declared as a method instance elsewhere receivedData=[[NSMutableData data] retain]; } else { // inform the user that the download could not be made } } - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { //NSLog(@challenged %@,[challenge proposedCredential] ); if ([challenge previousFailureCount] == 0) { NSURLCredential *newCredential; newCredential=[NSURLCredential credentialWithUser:[self username] password:[self password] persistence:NSURLCredentialPersistenceNone]; [[challenge sender] useCredential:newCredential forAuthenticationChallenge:challenge]; } else { [[challenge sender] cancelAuthenticationChallenge:challenge]; // inform the user that the user name and password // in the preferences are incorrect NSLog(@Invalid Username or Password); } } - (void)connection:(NSURLConnection *)connection didReceiveResponse: (NSURLResponse *)response { // this method is called when the server has determined that it // has enough information to create the NSURLResponse // it can be called multiple times, for example in the case of a // redirect, so each time we reset the data. // receivedData is declared as a method instance elsewhere //[receivedData setLength:0]; } - (void)connection:(NSURLConnection *)connection didReceiveData: (NSData *)data { //NSLog([[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]); // append the new data to the receivedData // receivedData is declared as a method instance elsewhere [receivedData appendData:data]; } - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { // release the connection, and the data object [connection release]; // receivedData is declared as a method instance elsewhere [receivedData release]; [theRequest release]; // inform the user NSLog(@Connection failed!
[twitter-dev] Re: iPhone twitter client
Welcome to Twitter OAuth Camp for mobile. I have written 4 chapters to explain how to integrate Twitter on iOS Android using OAuth library. I can't release the chapters now as our publisher is reviewing the content and getting it ready to publish the book in a short few months. The book will be released in early summer. It contains very details step-to-step explanation, screen captures, line by line coaching, code examples. I think this is the greatest thing b/c these chapters will help me to remember how to fight thru each step to get this to work. I am teaching iOS class. I am planning to teach Twitter iOS class and going to offer a class in a few weeks. The problem I have is I couldn't find a venue. I couldn't find any ideal dates at Hackerdojo. Plug N Play doesn't offer WiFi and/or available dates. Access Growth doesn't offer the venue as I haven't shown enough muscle. Any suggestions? On Jan 16, 2:01 pm, Rob Wilson - SpikyOrange netp...@gmail.com wrote: Hi, I'm planning on integrating with Twitter on the iPhone, I'm surprised that unlike Facebook, Twitter does not provide a standard Objective-C library, but I have found MGTwitterEngine. The problem is, the setup instructions are not that clear, then I found 'by accident' the Twitter-OAuth-iPhone project on GitHub, which seemed to at least bring up the Twitter authorisation page, but now fails with 401 errors and doesn't give me the opportunity to remove the token (hey, it's just a demo project, so I guess they don't handle it). The concern I have, is that when I registered my application, it wanted a callback URL, from what I understand I want the value OOB to be used, for our-of-band / Pin-code authorisation. I tried entering OOB and then it complained that I must enter a valid URL. I then deleted the URL completely and then the application was accepted, but I don't know whether a blank / missing URL == OOB? When I try to edit the application, it doesn't give me the option to add a URL. So, when programming for an iPhone, do you enter 'Application', or 'Web'. If the latter, what URL should be entered and can you edit it afterwards? Does anyone have advice on setting up MGTwitterEngine, or Twitter- OAuth-iPhone? For something that 'sounds' simple, it has taken me over a day of playing to get nowhere productive. However, I am new to iPhone develop, oAuth and the libraries mentioned above. I am planning on documenting what I learn on my blog afterwards, to help other iPhone developers. Feel free to follow me on Twitter, as I disucss the progress on my podcast BitBanterPC. Many thanks to anyone who can answer those questions. Regards, Rob. -- Twitter developer documentation and resources: http://dev.twitter.com/doc API updates via Twitter: http://twitter.com/twitterapi Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list Change your membership to this group: http://groups.google.com/group/twitter-development-talk
Re: [twitter-dev] Re: iPhone twitter client
Sounds like you would be better off considering goToWebinar, you could charge via paypal and only expose the URL to those who paid. I would be interested, but within the next week or so I would hope to have cracked it, so if you could do a webinar very soon, you have an interested person in your queue ;) You could join me in a podcast interview to detail your book, plus any other projects that your working on? Good luck! Rob Sent from my iPhone On 18 Jan 2011, at 02:08, Bess bess...@gmail.com wrote: Welcome to Twitter OAuth Camp for mobile. I have written 4 chapters to explain how to integrate Twitter on iOS Android using OAuth library. I can't release the chapters now as our publisher is reviewing the content and getting it ready to publish the book in a short few months. The book will be released in early summer. It contains very details step-to-step explanation, screen captures, line by line coaching, code examples. I think this is the greatest thing b/c these chapters will help me to remember how to fight thru each step to get this to work. I am teaching iOS class. I am planning to teach Twitter iOS class and going to offer a class in a few weeks. The problem I have is I couldn't find a venue. I couldn't find any ideal dates at Hackerdojo. Plug N Play doesn't offer WiFi and/or available dates. Access Growth doesn't offer the venue as I haven't shown enough muscle. Any suggestions? On Jan 16, 2:01 pm, Rob Wilson - SpikyOrange netp...@gmail.com wrote: Hi, I'm planning on integrating with Twitter on the iPhone, I'm surprised that unlike Facebook, Twitter does not provide a standard Objective-C library, but I have found MGTwitterEngine. The problem is, the setup instructions are not that clear, then I found 'by accident' the Twitter-OAuth-iPhone project on GitHub, which seemed to at least bring up the Twitter authorisation page, but now fails with 401 errors and doesn't give me the opportunity to remove the token (hey, it's just a demo project, so I guess they don't handle it). The concern I have, is that when I registered my application, it wanted a callback URL, from what I understand I want the value OOB to be used, for our-of-band / Pin-code authorisation. I tried entering OOB and then it complained that I must enter a valid URL. I then deleted the URL completely and then the application was accepted, but I don't know whether a blank / missing URL == OOB? When I try to edit the application, it doesn't give me the option to add a URL. So, when programming for an iPhone, do you enter 'Application', or 'Web'. If the latter, what URL should be entered and can you edit it afterwards? Does anyone have advice on setting up MGTwitterEngine, or Twitter- OAuth-iPhone? For something that 'sounds' simple, it has taken me over a day of playing to get nowhere productive. However, I am new to iPhone develop, oAuth and the libraries mentioned above. I am planning on documenting what I learn on my blog afterwards, to help other iPhone developers. Feel free to follow me on Twitter, as I disucss the progress on my podcast BitBanterPC. Many thanks to anyone who can answer those questions. Regards, Rob. -- Twitter developer documentation and resources: http://dev.twitter.com/doc API updates via Twitter: http://twitter.com/twitterapi Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list Change your membership to this group: http://groups.google.com/group/twitter-development-talk -- Twitter developer documentation and resources: http://dev.twitter.com/doc API updates via Twitter: http://twitter.com/twitterapi Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list Change your membership to this group: http://groups.google.com/group/twitter-development-talk