- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
Facebook iOS SDK 是否像 UIImagePickerController
那样提供任何默认的 (Facebook) 相册照片选择器?
我听说过这个所以搜索了很长时间但找不到任何东西。
如果有人对此有任何想法,请告诉我。如果不是,那么我肯定需要自己制作。
最佳答案
从 Facebook 导入
无需第三方工具即可从 Working For graph api 2.4、2.5、2.6、2.7、2.8 和 Facebook graph api 2.10 相册中获取 facebook 照片
1) 在Facebook开发者账户中添加应用
2) 然后在应用程序中选择平台以便更好地理解,请参见以下屏幕截图
3) 选择 ios 并按照向导中的所有步骤显示
4) 然后去graph api explore https://developers.facebook.com/tools/explorer/145634995501895/
5) 在 graph api explorer 中选择您的应用程序以获得更多了解显示屏幕截图
6) 点击 Get token ..然后在 get token 中点击 get access token 你可以看到这么多权限以便更好地理解看图片
7) 用于检查您的权限以获取相册名称和图像在屏幕截图后显示
如果 user_photos 权限未打开,则显示错误,请参见以下屏幕截图
完成第 7 步后,请执行以下步骤或仅下载编码文件。我已经把链接放在那里你可以下载
objective-c 的编码文件
https://www.dropbox.com/s/1ysek035ek88xuw/FacebookAlbum%20Demo.zip?dl=0
8) 如果没有错误显示,则在 View Controller 的 viewDidLoad 方法中执行以下代码。此代码用于获取相册名称和相册 ID。
Objective-C
FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
[loginManager logInWithReadPermissions:@[@"public_profile", @"email", @"user_friends",@"user_photos"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
{
[[[FBSDKGraphRequest alloc]
initWithGraphPath:@"me/albums"
parameters: nil
HTTPMethod:@"GET"]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if (!error) {
// NSLog("%@",result);
NSArray *data = [result valueForKey:@"data"];
name = [data valueForKey:@"name"];
ids = [data valueForKey:@"id"];
[self.Fbtableview reloadData];
}
}];
9) 现在在 tableview cell for row
中输入代码后获取相册封面照片Objective-C
coverid = [NSString stringWithFormat:@"/%@?fields=picture",[ids objectAtIndex:indexPath.row]]; **// pass album ids one by one**
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:coverid
parameters:nil
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error)
{
// NSLog("%@",result);
NSDictionary *pictureData = [result valueForKey:@"picture"];
NSDictionary *redata = [pictureData valueForKey:@"data"];
urlCover = [redata valueForKey:@"url"];
NSURL *strUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@",urlCover]];
NSData *data = [NSData dataWithContentsOfURL:strUrl];
UIImage *img = [[UIImage alloc] initWithData:data];
UIImageView *img1;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
img1= [[UIImageView alloc]initWithFrame:CGRectMake(10, 0, 50, 50)];
}
else
{
img1= [[UIImageView alloc]initWithFrame:CGRectMake(10, 0, 40, 40)];
}
[img1 setImage:img];
[img1 setContentMode:UIViewContentModeScaleAspectFit];
[cell.contentView addSubview:img1];
}];
10) 现在是获取相册照片 ID 的代码。
// code in **table didselect method**
Objective-C
NSString *strAlbumid = [NSString stringWithFormat:@"/%@/photos",[ids objectAtIndex:indexPath.row]];
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:strAlbumid
parameters:nil
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// NSLog("%@",result);
NSDictionary *data = [result valueForKey:@"data"];
arrId = [data valueForKey:@"id"];
PhotoViewControllerr *photoViewcontroller;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
photoViewcontroller = [[PhotoViewControllerr alloc]initWithNibName:@"PhotoViewController_Ipad" bundle:nil];
}
else
{
photoViewcontroller = [[PhotoViewControllerr alloc]initWithNibName:@"PhotoViewController" bundle:nil];
}
photoViewcontroller.picsArray = arrId;
[photoViewcontroller.navigationController setNavigationBarHidden:YES];
[[self navigationController] pushViewController: photoViewcontroller animated:YES];
}];
11) 另一个 View Controller 现在代码用于在 collection view cellforRow
中获取图像Objective-C
NSString *strAlbumid = [NSString stringWithFormat:@"/%@/?fields=images",[self.picsArray objectAtIndex:indexPath.row]];
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:strAlbumid
parameters:nil
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error)
{
//NSLog("%@",result);
picture_images = [result valueForKey:@"images"];
NSMutableArray *picCount = [picture_images objectAtIndex:picture_images.count - 1];
NSURL *strUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@",[picCount valueForKey:@"source"]]];
dispatch_queue_t q = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
dispatch_async(q, ^{
/* Fetch the image from the server... */
NSData *data = [NSData dataWithContentsOfURL:strUrl];
UIImage *img = [[UIImage alloc] initWithData:data];
dispatch_async(dispatch_get_main_queue(), ^{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
img1= [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
}
else
{
img1= [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
}
img1.image = img;
img1.contentMode = UIViewContentModeScaleAspectFit;
[cell.contentView addSubview:img1];
});
});
}];
12) 获取数据后,您必须在 facebook 中提交您的应用程序,以便提交您可以填写信息
1)应用详情
2)现状与回顾
=====
如果您有任何疑问,我会帮助您
享受快乐的编码。
关于iOS :How to get Facebook Album Photo's Picker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30207465/
我为我们的业务创建了一个 Facebook 页面,我创建了一个 Facebook 应用程序来获取 AppID,以便在 Facebook 插件中使用它。 我注意到 Facebook 应用程序的页面看起来
是否有可能知道哪个 Facebook 用户点击了我的应用用户在 Facebook 上分享的链接? 为了清楚起见,让我改写一下:我想知道我的应用用户的哪些 friend 点击了他的共享链接。 感谢任何提
我正在浏览 facebook pixel,对 facebook pixel 如何知道哪个转化来自哪个 facebook 广告感到很困惑? 假设我有这个 url http://example.com安装
我正在开发 sucsongmoi.net(越南语),当浏览者从他们的墙上分享网站链接时,一些链接 facebook 获得描述和图像,一些链接 facebook 无法获得描述和图像。 例如:分享 suc
一位同事错误地设置了个人 Facebook 页面;它应该是一个企业 Facebook 页面。 个人页面上有几个 friend 需要重定向到正确的 Facebook 业务页面。 我可以将用户从错误的个人
在 Facebook 上,当您转到“编辑我的个人资料”>“艺术和娱乐”时,会有一个“电影”自动完成小部件,它会在您输入电影时推荐电影。 因此,如果您输入“Jones”,它将开始建议: 印第安纳琼斯 布
我在我的网页上使用 Facebook 登录。首次登录时,Facebook 登录应用程序会请求获取用户数据的权限。 有什么方法可以改善这个问题,以请求喜欢我的 Facebook 页面的许可?用户点击后,
我需要知道是否可以将现有的 Facebook 页面(类别:应用程序页面)链接到 Facebook 应用程序?当我进入 Facebook 应用程序设置时,他们建议创建一个新页面。但我需要的只是链接到现有
我的网站应用程序具有通过 Facebook 登录进行登录的功能。为此,我的应用程序出现在 Facebook 上。使用 Facebook 登录工作正常。 但应用程序具有将 Facebook 帐户链接和取
我正在制作一个应用程序,让人们可以在 Facebook 上与特定的 friend 分享内容。示例:Alice 使用我的应用程序,她与 Bob 分享了一篇文章,Bob 是她的 Facebook 好友。现
我正在按照列出的说明进行操作 http://docs.appcelerator.com/platform/latest/#!/api/Modules.Facebook 并查看 Arrow 示例目录中的
假设我有一个餐厅的商业网站,一位顾客为一大群人预订了一张 table 。有没有一种方法可以让客户有机会在餐厅网站上创建 Facebook 事件,作为预订流程的一部分。我知道客户必须以某种方式从餐厅网站
我想让我的用户将他们的用户帐户与 Facebook 或 Twitter 相关联,并允许他们使用他们的 Facebook/Twitter 帐户登录我的服务器,而不是使用传统的用户名/密码。与StackO
我们有一个面子书页面。我们添加了一个自定义 FBML 选项卡。现在我们要添加评论面子书插件。我尝试添加一个脚本,我从 Face book Social Plug in .代码是 之后我将此脚本放入自
大家好 请帮我找到关于以下的官方信息: 1) 什么是“FaceBook 登录” 2) 什么是“FaceBook Connect” 谢谢 最佳答案 你可以在那里找到你需要的一切: http://deve
这是最奇怪的事情。我有非常简单的 CF 代码,查看 cgi.HTTP_REFERER。简单地说,它查看推荐人。如果链接是从我们的主要网站域之外单击的,它会显示一些内容。否则,什么也不会发生。所以,如果
我还是 Facebook Graph API 的新手,正在尝试开始使用 Facebook 地点搜索。 (按位置搜索地点) https://graph.facebook.com/search?type=
我不想开设 Facebook 帐户,但我被要求为需要使用 Facebook API 的应用程序开发功能。有没有一种方法可以开发这些功能并使用 Facebook API,而无需开设个人 Facebook
我已经按照指示实现了 DotNetOpenAuth 提供的示例应用程序 here . 正如您在下面看到的,这要求用户安装此 facebook 应用程序。 我只是想让用户使用他们的 Facebook 登
我的主页上有标准的 Facebook 登录按钮,我不希望人们仅在用户单击登录按钮时使用他们的 Facebook 帐户自动登录我的网站。 如果用户未登录 Facebook,将出现一个弹出窗口询问他的凭据
我是一名优秀的程序员,十分优秀!