EzDevInfo.com

MGTwitterEngine

Objective-C Twitter integration library for Mac OS X and iPhone. Official repository. Cocoa Source Code - Matt Gemmell open source code for ios (cocoa touch) and mac os x (cocoa), by matt gemmell. mgtwitterengine, mgsplitviewcontroller, and more.

how to add twitter timeline to iphone app?

i have already been able to implement twitter status updates using mgtwitter engine and oauth, my problem is getting the users timeline and putting it into a table view. i know i need to get the information through the twitter api and parse it to be put into a table.

i have searched the internet and can not find a clear path to what i want to do, any help would be great. i am not looking for someone to solve the problem, more of a push in the right direction with clear instructions.

thanks in advance for any help provided ;-)

i forgot to say im building an iPhone app, that tutorial doesnt look like it would work :-s


Source: (StackOverflow)

MGTwitter is not working

I don't want default twitter to open because it should be compatible with ios < 5 also .

I've used MGTwitterEngine. But it doesn't post tweets. Before few days it was working fine with ios5 too. But now it's not working. I think twitter demo url is depreceated , or not supported with ios5 & 6. What could be the reason? while posting something to twitter the request gets failed & I'm gettiing following error :

Error Domain=HTTP Code=404 "The operation couldn’t be completed. (HTTP error 404.)

Any help would be appreciated !!


Source: (StackOverflow)

Advertisements

how to install libOAuth.a for twitter + oauth in iphone app

I have installed twitter + oauth library into my project. Its working fine while I am running my app on simulator but when I run my app into my device or archiving my app to generate ipa it shows me an error like below given image - enter image description here

when I faced such issue I have made settings in my project file as shown in below images - In Target - enter image description here

In target which I have shown in above image I have made changes on other linker flag as -lz, in header search path as - iphoneos/usr/include/libxml2 and in library search paths. The changes in above field which I have made in target like as given below images - enter image description here

I have also made change in project part as given below image in other linker flag,header search path and library search path - enter image description here

guys, I'm not able to generate .ipa or run in device due to above generated error. PLease, provide me a solution to resolve this error. and provide me guidence where am I going wrong. Your help will be appreciated. thanks.


Source: (StackOverflow)

Uploading image on twitter using twitpic

I want to upload image on twitter.For this I used Twitpic API .I am able to upload image using oauth in which i need to enter pin manually .Please anyone suggest me how to upload image via twitpic from mgtwitter engine so that I do not have to enter pin manually. Thanks in advance.


Source: (StackOverflow)

How to setup MGTwitterEngine

Just downloaded from github ... tried to build the xcode project and got over a hundred errors. TouchJSON, OAuthConsumer and yajl folders don't even exist (which looks like the problem).

Did I pooch something? What do I need to do to recover?

Thanks


Source: (StackOverflow)

TARGET_OS_IPHONE and ApplicationTests

Why doesn't this code work when compiling an ApplicationTests unit test bundle?

#if TARGET_OS_IPHONE
   #import <Foundation/Foundation.h>
   #import <UIKit/UIKit.h>
#else
   #import <Cocoa/Cocoa.h>
#endif

One of my dependencies has this check and compiles just fine in my main application bundles, but it tries to load <Cocoa/Cocoa.h> when compiling my ApplicationTests bundle. It's probably just my lack of understanding of XCode, but I get nervous when my test bundles don't build. Any suggestions?


Source: (StackOverflow)

Twitter api for iPhone OS4

It looks like the twitter api refused to work for iPhone OS4 :( (Twitter+OAuth http://github.com/bengottlieb/Twitter-OAuth-iPhone). When I building the project to which I just add the Twitter+OAuth I see the following:

alt text

It's really really important for me! Any help will be greatly appreciated!

Many thanks in advance!!!!!!!


Source: (StackOverflow)

Twitter-oAuth-library for iPhone development

I'm looking for a oAuth/xAuth-Twitter-library for iPhone/Objective-C. I found MGTwitterEngine, but that didn't work, as they don't even link to the external libraries needed for it to work (heck, the example you download doesn't even work out-of-the-box!).

So, do you know any alternative libraries that do this, or how I can make MGTwitterEngine work? Thank you.


Source: (StackOverflow)

How to post tweet from iPhone without PIN using SA_OAuthTwitterEngine?

I am developing a iPhone application which sends tweets to twitter. For this I am using SA_OAuthTwitterEngine + MGTwitterEngine classes.

I register applicaiton to www.twitter.com/apps and pass Consumer key and Consumer secret to controller my code is this.

if(!_engine){
    _engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];
    _engine.consumerKey    = slPcFUjUh5y1hex0zvEhPg;
    _engine.consumerSecret = u6ydovMdP9yeiVqDukVhIzZPgJR9XDPUwfxymzNs;  
}

UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self];

if (controller){
    [self presentModalViewController: controller animated: YES];
    intTwitterFlag = 1;
}

Previously on twitter.com/apps I select Application type = client and my application will generate PIN and accessToken. But when i change my Application type = Browser it cannot generate PIN and accessToken.

Previously when application type is client i am giving user name and password and then control return to my application from the webview but now after entering user name and password it cannot dismissModalViewController but showing Select and Copy the PIN.

Thank you for your time and any help you can give me!


Source: (StackOverflow)

iOS - OAuth Twitter enginer - Failing to create tokens

In my app, i am trying to integrate posting messages to twitter. (I've generated consumer key and consumer secret in my twitter applicatin.
I'm using following code.

#pragma mark SA_OAuthTwitterEngineDelegate
- (void) storeCachedTwitterOAuthData: (NSString *) data forUsername: (NSString *) username {
    NSUserDefaults          *defaults = [NSUserDefaults standardUserDefaults];

    [defaults setObject: data forKey: @"authData"];
    [defaults synchronize];
}

- (NSString *) cachedTwitterOAuthDataForUsername: (NSString *) username {
    return [[NSUserDefaults standardUserDefaults] objectForKey: @"authData"];
}

- (void) twitterOAuthConnectionFailedWithData: (NSData *) data
{
    NSLog(@"Failed");
}
//=============================================================================================================================
#pragma mark SA_OAuthTwitterControllerDelegate
- (void) OAuthTwitterController: (SA_OAuthTwitterController *) controller authenticatedWithUsername: (NSString *) username {
    NSLog(@"Authenicated for %@", username);
}

- (void) OAuthTwitterControllerFailed: (SA_OAuthTwitterController *) controller {
    NSLog(@"Authentication Failed!");
}

- (void) OAuthTwitterControllerCanceled: (SA_OAuthTwitterController *) controller {
    NSLog(@"Authentication Canceled.");
}

Its authorizing successfully, but the following delegate method is printing null username.

- (void) OAuthTwitterController: (SA_OAuthTwitterController *) controller authenticatedWithUsername: (NSString *) username

The following is the response that I'm getting:

2011-12-29 00:01:57.965 OAuthTwitterDemo[4656:207] Failed
2011-12-29 00:01:57.966 OAuthTwitterDemo[4656:207] Authenicated for (null)

Can some one suggest me what's the mistake in my code?


Source: (StackOverflow)

MGTwitterEngine and iPhone

I downloaded MGTwitterEngine and added to my iPhone project. It's connecting and getting statues I can tell from dumping them into an NSLog. But, I can't figure out how how I need to parse the calls so I can add them to a table. They are returned as an NSString and look like this:

      {
    "created_at" = 2009-07-25 15:28:41 -0500;
    favorited = 0;
    id = 65;
    source = "<a rel='nofollow' href=\"http://twitter.com/\">Twitter</a>";
    "source_api_request_type" = 0;
    text = "The wolf shirt strikes again!! #sdcc :P http://twitpic.com/blz4b";
    truncated = 0;
    user =         {
        "created_at" = "Sat Jul 25 20:34:33 +0000 2009";
        description = "Host of Tekzilla on Revision3 and Qore on PSN. Also, a geek.";
        "favourites_count" = 0;
        "followers_count" = 0;
        following = false;
        "friends_count" = 0;
        id = 5;
        location = "San Francisco";
        name = "Veronica Belmont";
        notifications = false;
        "profile_background_tile" = false;
        "profile_image_url" = "http://blabnow.com/avatar/Twitter_10350_new_twitter_normal.jpg";
        protected = 0;
        "screen_name" = Veronica;
        "statuses_count" = 2;
        "time_zone" = UTC;
        url = "http://www.veronicabelmont.com";
        "utc_offset" = 0;
    };

Anybody used this that can tell me how everyone else uses it in their project?

Thanks


Source: (StackOverflow)

Ben Gottlieb's Twitter+OAuth iOS SDK - username parameter returning nil

It seems that over the weekend, the following Delegate method

- (void)OAuthTwitterController:(SA_OAuthTwitterController *)controller authenticatedWithUsername:(NSString *)username

began returning nil for the username parameter.

I wanted to see if anyone else using Ben Gottlieb's SDK can confirm this issue.

Thanks


Source: (StackOverflow)

Invite Twitter friends for app

How can we invite our Twitter friends/Followers for any app/Event using my app. For doing the same thing in Facebook I am posting some message to my friends wall. is there any way to do the same thing using MGTwitterEngine.

Thank in advance


Source: (StackOverflow)

Inconsistency with MGTwitterEngine for iOS?

Before, MGTwitterEngine was working perfectly for me, but now everytime I login, i get an invalid url exception from OAuth. I thought it was because i changed something but when I tried logging in from the iphone simulator, it worked (i was trying from my iphone). I then tried an old copy of my project from 3 days ago when i had absolutely no problem, and now i'm getting the same url error. Has anybody encountered this?

To temporarily fix this, I went into SA_OauthTwitterEngine.m and did

- (SA_OAuthTwitterEngine *) initOAuthWithDelegate: (NSObject *) delegate {
    if (self = (id) [super initWithDelegate: delegate]) {
        self.requestTokenURL = [NSURL URLWithString: @"http://twitter.com/oauth/request_token"];
        //self.accessTokenURL = [NSURL URLWithString: @"http://twitter.com/oauth/access_token"];
        self.accessTokenURL = [NSURL URLWithString: @"https://api.twitter.com/oauth/access_token"];
        self.authorizeURL = [NSURL URLWithString: @"http://twitter.com/oauth/authorize"];
    }
    return self;
}

There was a problem with the http://twitter.com/oauth/access_token url so I changed it to https://api.twitter.com/oauth/access_token which was in the documentation for the twitter API. It just feels uncomfortable having to alter this since it seems to be working fine for everybody else.

Any help is appreciated


Source: (StackOverflow)

iPhone and Twitter API OAuth Consumer Keys and Secrets

I have a issue while loading my data from Twitter. The method I posted below works for about 5-10 minutes then it freezes up my consumer keys....

I know it is the keys because I have the app already installed on the device working then I will make changes and run on the simulator and it affects the device as well. This last for about 30 minutes then the keys seem to refresh themselves and work without any changes to the actual code. Sometimes I will just go in Twitter Dev were my application is and reset the keys and replace the keys in my code and that works for about 10 minutes then the same thing happens!

Here is the code I am using to call out to twitter OAuth and receive the objects for my UITableView.

- (void)viewDidAppear:(BOOL)animated
{
    if(_engine) return;

    _engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];
    _engine.consumerKey = @"key";
    _engine.consumerSecret = @"key";

    UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine: _engine delegate: self];

    if (controller) 
        [self presentModalViewController: controller animated: YES];
    else
    {
        userAvatar.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://a2.twimg.com/profile_images/1361674958/Wintboard_200px.png" ]]];

        tweets = [[NSMutableArray alloc] init];
        authors = [[NSMutableArray alloc] init];
        avatarsURL =[[NSMutableArray alloc] init];
        friendsCount = [[NSMutableArray alloc] init];
        followerCount = [[NSMutableArray alloc] init];
        retweetCount = [[NSMutableArray alloc] init];

        //retweetCount = [[NSMutableArray alloc] init];

        [self updateStream:nil];
        [progressView.view removeFromSuperview];
    }
}

#pragma mark IBActions 

-(IBAction)updateStream:(id)sender
{
    // [_engine sendUpdate:[textfield text]];
    [_engine getFollowedTimelineSinceID:0 startingAtPage:0 count:100];

    //[_twitter getFollowedTimelineSinceID:0 startingAtPage:0 count:0];

    NSString *path = [[NSBundle mainBundle] pathForResource:@"unlock" ofType:@"caf"];
    AVAudioPlayer* theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];
}

-(IBAction)tweet:(id)sender
{   
    [_engine sendUpdate:[textfield text]];
    [self updateStream:nil];
    if (textfield isFirstResponder])
    {
        textfield.text = @"";
        [textfield resignFirstResponder];
    }
}

-(BOOL)textFieldShouldClear:(UITextField*)textfield
{
    return  YES;
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    // the user pressed the "Done" button, so dismiss the keyboard
    [textField resignFirstResponder];
    return YES;
}

// Return YES for supported orientations

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation
{
    return YES;
}

#pragma mark UITableViewDataSource Methods 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section    
{    
    // [_engine sendUpdate:[textfield text]];
    [_engine getFollowedTimelineSinceID:0 startingAtPage:0 count:100];

    int count = [tweets count];
    int count2 = [authors count];
    int count3 = [avatarsURL count];

    //Return just enough cells to fill the screen during loading ....
    if (count == 0)
        count = MyCustomRowCount;

    return count = 100;
    return count2 = 100;
    return count3 = 100;

    // return  count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *identifier = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil)
    { 
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier] autorelease];
    }

/*
    //Here it adds a nice shadow to the table view but will crash on rotation and send a wird dump 
    tableView.layer.shadowColor = [[UIColor blackColor] CGColor];
    tableView.layer.shadowOffset = CGSizeMake(1.0f, 1.0f);
    tableView.layer.shadowRadius = 8.0f;
    tableView.layer.shadowOpacity = 1.0f;     
*/

    [cell.textLabel setNumberOfLines:1];
    [cell.textLabel setText:[(Tweet*)[authors objectAtIndex:indexPath.row] author]];  

    [cell.detailTextLabel setText:[(Tweet*)[tweets objectAtIndex:indexPath.row] tweet]];
    [cell.detailTextLabel setNumberOfLines:10];
    [cell.textLabel setTextColor:[UIColor darkGrayColor]];
    [cell.textLabel setShadowColor:[UIColor whiteColor]];
    [cell.textLabel setShadowOffset:CGSizeMake(0.5, 0.5)];
    [cell.detailTextLabel setTextColor:[UIColor blackColor]];
    //[cell.detailTextLabel setText:[(Tweet*)[retweetCount objectAtIndex:indexPath.row] reTweetCount]];
    [cell.textLabel setUserInteractionEnabled:YES];
    [cell.contentView setMultipleTouchEnabled:YES];

    // Here we use the new provided setImageWithURL: method to load the web image with SDWebImageManager
    [cell.imageView setImageWithURL:[NSURL URLWithString:[(Tweet*)[avatarsURL objectAtIndex:indexPath.row]avatarURL]]
    placeholderImage:[UIImage imageNamed:@"avatar.png"]];

    //add gradient to cell 
    UIImage *gradient = [UIImage imageNamed:@"gradientcell2.png"];
    UIImageView *cellimage = [[UIImageView alloc] initWithImage:gradient];
    cellimage.contentMode = UIViewContentModeScaleToFill;
    cell.backgroundView = cellimage;

    [cellimage release];      

    UIImage *selectedGradient = [UIImage imageNamed:@"selectedcell.png"];
    UIImageView *selectedCell = [[UIImageView alloc] initWithImage:selectedGradient];
    selectedCell.contentMode = UIViewContentModeScaleToFill;
    cell.selectedBackgroundView = selectedCell;    

    [tableView setBackgroundColor:[UIColor clearColor]];

    return cell;
}

Source: (StackOverflow)