Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Tools & Utilities

Reply
 
LinkBack Thread Tools Display Modes
Old 01-21-2010, 02:29 PM   #51 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 21
Default

removed

Last edited by eyefone; 01-21-2010 at 05:21 PM.
eyefone is offline   Reply With Quote
Old 01-26-2010, 12:57 PM   #52 (permalink)
Registered Member
 
Join Date: Jan 2009
Location: Atlanta
Posts: 411
Default

Hi,

I'm using the FBAgent last modified on Jan 13th at 12:47pm. My loginviewcontroller is the FacebookAgentDelegate (I set the protocol).

Code:
//
//  LoginViewController.m
//  AppName
//
//  Created by luis on 1/23/10.
//  Copyright 2010 Mirando LLC. All rights reserved.
//

#import "LoginViewController.h"


@implementation LoginViewController

/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        // Custom initialization
    }
    return self;
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
	
	 fbAgent = [[FacebookAgent alloc] initWithApiKey:@"KEY_REMOVED"  
				                                             ApiSecret:@"SECRET_REMOVED"  
				                                              ApiProxy:nil];  
	     fbAgent.delegate = self;  
	
	[self updateStatus:self];
    [super viewDidLoad];
}



/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}

#pragma mark Facebook Methods

 -(IBAction)updateStatus:(id)sender{  
	 [fbAgent publishFeedWithName:@"Testing iPhone Valentines App I'm creating"  
		                      captionText:@"How do I love thee Cheesy text"  
		                         imageurl:@"http://www.mirando-llc.com/mypic.png"  
		                          linkurl:@"http://mirando-llc.com/"  
		                userMessagePrompt:@"Testing my iPhone App..."];
 
 
	 NSLog(@"Made it to update status...");
	 NSLog(@"==> %s",__PRETTY_FUNCTION__);
	 NSLog(@"logged in to facebook?: %d",[fbAgent isLoggedIn]);

 }  


@end
The error I get is:
Code:
2010-01-26 12:44:36.935 AppName[575:20b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[LoginViewController facebookAgent:loginStatus:]: unrecognized selector sent to instance 0x3d1b350'
2010-01-26 12:44:36.936 AppName[575:20b] Stack: (
    8307803,
    2523184699,
    8689723,
    8259316,
    8111810,
    18070,
    55645,
    41983,
    49041,
    50445,
    3020196,
    3020051,
    13428152,
    13426200,
    13426914,
    13429398,
    13088725,
    8091873,
    8088648,
    1152909,
    1153106,
    23633923,
    10168,
    10022
)
Any help would be greatly appreciated.

Last edited by funkytaco; 01-26-2010 at 01:01 PM.
funkytaco is offline   Reply With Quote
Old 01-26-2010, 02:42 PM   #53 (permalink)
indie dev
 
rocotilos's Avatar
 
Join Date: Oct 2009
Posts: 2,754
Default

Did you put this line in your viewcontroller.h?

#import "FacebookAgent.h"

And you need to add all the sourcecode of facebook agent AND facebook connect to your project too.
rocotilos is offline   Reply With Quote
Old 02-13-2010, 10:47 AM   #54 (permalink)
Registered Member
 
Join Date: Oct 2008
Posts: 10
Default

Thank you so much for this - that's awesome!!!
jbellanca is offline   Reply With Quote
Old 02-14-2010, 01:38 PM   #55 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 9
Default

This is some awesome code here. I am really new at all of this, but have managed to get it almost working the way I need it. I would like to have it take a screen shot of the view, and upload it to face book. I have it uploading the view, but not a screenshot of other things that are in the view. hope that makes sense.

I have been using a screenshot button, to save to the camera roll, and would like to use that same type of button to send to facebook.

any help here would be great.
Vonswanko is offline   Reply With Quote
Old 02-14-2010, 01:49 PM   #56 (permalink)
iPhone Developer, PlayDom
 
AmanApps's Avatar
 
Join Date: Jul 2009
Posts: 61
Default

if you want the screeshot the following link may come into help:

Apple - Support - Discussions - (iphone) application screenshot from ...

Thanks.
AmanApps is offline   Reply With Quote
Old 02-14-2010, 04:10 PM   #57 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 9
Default

Hey thanks so much. I figured it out, was just using the wrong name for my image that I wanted to keep and upload. Now to submit the update to Apple and play the waiting game

Thanks again for the help.
Vonswanko is offline   Reply With Quote
Old 02-14-2010, 04:43 PM   #58 (permalink)
iPhone Developer, PlayDom
 
AmanApps's Avatar
 
Join Date: Jul 2009
Posts: 61
Default

don't forget to share your app link once approved... i will love to play that (if affordable )

Best of luck.
AmanApps is offline   Reply With Quote
Old 02-14-2010, 05:41 PM   #59 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 9
Default

Quote:
Originally Posted by AmanApps View Post
don't forget to share your app link once approved... i will love to play that (if affordable )

Best of luck.

Its in the app store now..free version

paid version..this is the one I will be putting the facebook connect in.

The free version just has ads..but all the same functions.

Thanks again.
Vonswanko is offline   Reply With Quote
Old 02-14-2010, 08:00 PM   #60 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 9
Default

OK, so here's a bug I have found. Updates the pic to an album, but if the user hasn't given the album permission, it crashes. And also, sometimes after posting an update, with pic, after having the app open for a couple of seconds, it just crashes.
Vonswanko is offline   Reply With Quote
Old 02-17-2010, 07:31 AM   #61 (permalink)
iPhone Developer, PlayDom
 
AmanApps's Avatar
 
Join Date: Jul 2009
Posts: 61
Default

Thanx Vonswanko for the bug report. Could tress where is the prob?
AmanApps is offline   Reply With Quote
Old 02-17-2010, 08:29 AM   #62 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 9
Default

Not sure where the problem is, but it may be in the way it grabs the screenshot. Going to try a few other things. One other problem is that it will sometimes crash after invoking the Facebook connect, after signing in, then hit connect. But it still sends the pic. Weird.
Vonswanko is offline   Reply With Quote
Old 02-19-2010, 08:37 AM   #63 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 11
Default

After February 17, Facebook seems to suddenly could not upload a picture, and with the App Store's Facebook APP can not upload pictures. Facebook App's review have complained that the pictures can not upload
zxl777 is offline   Reply With Quote
Old 02-20-2010, 10:21 AM   #64 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 11
Default

With the developer account sign in Facebook, i can successfully upload a picture, and directly see the news feed.
With other ordinary account login Facebook, i can successfully upload a picture, but I can not see the news feed,
Then found in Facebook - "in Your Photos - iToyTools Photos can be seen "This album contains photos uploaded from another application. Select photos to approve or reject."

Must approve the photos then photo appear in the news feed.

Is it must "submit your application to the directory"
zxl777 is offline   Reply With Quote
Old 02-20-2010, 01:31 PM   #65 (permalink)
indie dev
 
rocotilos's Avatar
 
Join Date: Oct 2009
Posts: 2,754
Default

Yup, that is normal I think. Photos uploaded by apps need a consent from user first.
rocotilos is offline   Reply With Quote
Old 02-20-2010, 10:05 PM   #66 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 11
Default

Quote:
Originally Posted by rocotilos View Post
Yup, that is normal I think. Photos uploaded by apps need a consent from user first.
But The Facebook APP in App Store can upload photo, and do not need a consent from user first.

So i think how to do that?
zxl777 is offline   Reply With Quote
Old 02-21-2010, 02:45 AM   #67 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 11
Default

I am sure I found 2 bug
1, upper right corner of the dialog box is not the Close button (X), re-add FBConnect.bundle can resolve this problem.

2, if only call a function to upload pictures, there is no implementation of the [self askPermission];, the consequences can not update the status, upload pictures are in the auditing of the state.
Want to have a good approach, want to update, thank you
zxl777 is offline   Reply With Quote
Old 02-21-2010, 11:48 AM   #68 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 9
Default

I finally figured out the crash after uploading issue. With a little reading in some other threads, I changed these 2 things:

1. Using NSMutableDictionary in agent instead of NSDictionary
2. In the request, using photos.upload instead of facebook.photos.upload,




Thanks to all on this site, and for this drop in code.
Vonswanko is offline   Reply With Quote
Old 02-23-2010, 08:26 PM   #69 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 17
Question

I'm getting an EXC_BAD_ACCESS crash when uploading an image. I've confirmed that the image data is good, since I used it with Facebook Connect as well. For the image data I do:

Code:
NSData *imageData = UIImageJPEGRepresentation(self.myImage, 1.0);
[fbAgent uploadPhotoAsData:imageData withStatus:statusText.text caption:nil toAlbum:nil];
I've already made the NSDictionary -> NSMutableDictionary change mentioned in FacebookAgent.m.
Has anyone else had this issue or found a solution?
youknowho is offline   Reply With Quote
Old 03-09-2010, 12:13 AM   #70 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 11
Default

How to get friends list, then post news to friend's Wall?
zxl777 is offline   Reply With Quote
Old 03-09-2010, 12:49 AM   #71 (permalink)
iPhone Developer, PlayDom
 
AmanApps's Avatar
 
Join Date: Jul 2009
Posts: 61
Default

hi, actually it is very simple and basic implementation with minimum to no testing.

I wish i could work on these but got stuck with new game and tons of work

feel free to update and use as you want
AmanApps is offline   Reply With Quote
Old 03-15-2010, 03:19 PM   #72 (permalink)
Registered Member
 
Join Date: Sep 2008
Posts: 99
Default This is one of the all-time great threads here

My gosh this code is helpful!

I have everything working fairly well in my new facebook intergrated app, thanks to this generous code. I upload the photo first (which, as has been mentioned, posts a somewhat unwanted entry to their wall about the photo itself, but it's not too bad), the actual call is just:

Code:
[fbAgent uploadPhotoAsData:myData withCaption:nil toAlbum:nil];
Then I wrote this method, which triggers when the upload completes (a second or two):

Code:
- (void) facebookAgent:(FacebookAgent*)agent photoUploaded:(NSString*) pid{
	currentPid = pid;
	
	currentPhotoURL = [NSMutableString stringWithFormat: @"http://www.facebook.com/photo.php?pid="];
	NSString *endNumbers = [currentPid substringWithRange: NSMakeRange(16,5)]; // ex: 100000864320548_21858
	NSString *startNumbers = [currentPid substringWithRange: NSMakeRange(0,15)];
	[currentPhotoURL appendString:endNumbers];
	[currentPhotoURL appendString:@"&id="];
	[currentPhotoURL appendString:startNumbers];
	NSLog(@"The URL we're going to use is: %@", currentPhotoURL);
	[self publishStream];
}
That way I know what the URL is for photo we just uploaded, but I avoided fql calls because I am too dumb to comprehend them... this is a bit hackish, but I doubt it will break anytime too soon.

And as you can see, that calls my publishStream method:

Code:
- (void) publishStream {
	[[BusyAgent defaultAgent] makeBusy:NO];
		[fbAgent publishFeedWithName:@"Boy am iSorry!" 
						 captionText:@"Please accept this heartfelt apology note." 
							imageurl:@"http://renditionsdesign.com/iSorry_example.png"  
							 linkurl:currentPhotoURL
				   userMessagePrompt:@"What's on your mind?" 
						 actionLabel:@"iSorry for iPhone"
						  actionText:@"Available on the App Store" 
						  actionLink:@"http://itunes.apple.com/us/app/magic-card/id290645875?mt=8"];
}
(I realize it links to a different one of my apps for now, I'll fix that link eventually)

So, everything works fine, and I'm so happy! But only on the simulator. There has been discussion about a bug in this FaceBook agent code that used NSDictionary when NSMutableDictionary is needed, but I can't seem to solve my problem by changing that.

The console log from my crashed device is:

2010-03-15 12:06:11.498 iSorry[2254:207] *** -[FacebookAgent count]: unrecognized selector sent to instance 0x11f5b0
2010-03-15 12:06:11.504 iSorry[2254:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[FacebookAgent count]: unrecognized selector sent to instance 0x11f5b0'
2010-03-15 12:06:11.508 iSorry[2254:207] Stack: (
844776241,
843056877,
844780055,
844282517,
844245696,
844679949,
844679821,
65045,
27473,
29997,
71069,
55039,
62509,
64409,
826631361,
826631235,
834292747,
834238481,
834238839,
834238839,
834238229,
834238157,
834238031,
834237937,
844528285,
844526429,
848374975,
848375147,
850798447,
850793587,
10725,
10588
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
[Switching to thread 11779]
(gdb)

I hope my code above / explanation of how to do facebook status postings "farmville style" is helpful to someone. Anybody have any idea what I need to do to make this run on an actual device?
hobbyCoder is offline   Reply With Quote
Old 03-15-2010, 03:43 PM   #73 (permalink)
Registered Member
 
Join Date: Sep 2008
Posts: 99
Default

It's definitely the call to uploadPhotoAsData that kills it, not the actual publishing of the stream or any of the little things I do during the process, I've been able to narrow it down pretty conclusively to that.

I just don't really understand the code in the FacebookAgent.m file well enough to fix it (he's a better programmer than me, that's for sure).

Code:
[fbAgent uploadPhotoAsData:myData withCaption:nil toAlbum:nil];
Also, even if I use the nifty sample project that AmanApps posted (Facebook Agent Test) it crashes in exactly the same way if I use uploadPhotoAtURL or uploadPhotoAsData. Anyone else see a bug in there that we can fix? I know there are others with variations on this same problem. Maybe I just don't understand the NSDictionary ---> NSMutableDictionary fix that was mentioned....?

Last edited by hobbyCoder; 03-15-2010 at 04:21 PM.
hobbyCoder is offline   Reply With Quote
Old 03-22-2010, 05:49 AM   #74 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 11
Default

Now there are always users to complain, APP tips are sent successfully, but has nothing on the WALL.

I re-register a new facebook account and then upload the picture test, is completely successful.

This problem is strange, because I can not reproduce the problems encountered by users.

Have you found this problem? How to solve?
zxl777 is offline   Reply With Quote
Old 03-26-2010, 01:33 PM   #75 (permalink)
Registered Member
 
scotopia's Avatar
 
Join Date: Oct 2008
Posts: 2,028
Default

Hey Aman,

I'm suddenly having a bizarre problem when trying to publish a feed with facebook connect; it used to work but now when I hit my button that tells it to publish a feed, the facebook popup window comes up as usual, the activity meter spins for a second as usual...but then the activity meter disappears and the white popup just stays there forever...feed never gets published. Did something change in FB Connect recently or something? It's possible I somehow changed something to screw it up. It's worth noting that I can do a regular status update just fine. Here's some sample relevant code:

Code:
//this works
[fbAgent setStatus:[NSString stringWithFormat: @"%@", rootViewController.mainView.myLabel.text]];

//wheras this does not anymore..
[fbAgent publishFeedWithName:rootViewController.mainView.myLabel.text
						 captionText:@"Some Caption"
							imageurl:@"http://www.myserver.com/someImage.jpg"
							 linkurl:@"http://www.google.com"
						 actionLabel:@"Please Work"
						  actionText:@"Damn!" 
						  actionLink:@"http://www.google.com"];

THis is the last thing standing in my way of release...please help; thanks!
scotopia is offline   Reply With Quote
Reply

Bookmarks

Tags
facebook, facebook api, facebook connect

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 265
17 members and 248 guests
14DEV, @sandris, ADY, ArtieFufkin10, bookesp, ckgni, Dani77, DarkAn, HemiMG, iDifferent, jakerocheleau, JasonR, prchn4christ, Rudy, Speed, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,767
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:49 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0