某些应用在iOS 6中显示默认操作表,其中包含共享选项.
社交框架只有两个类,一个用于撰写,一个用于请求.
我发现的是关于使用SLComposeViewController为特定服务进行编写,在显示之前我必须手动查询服务是否可用.然后我还必须使用自己的图标创建自己的操作表.
这些应用程序如何在iOS 6中显示此默认共享选项操作表?或者他们是否使用开源框架?
使用iOS 6的新SLComposeViewController功能发布到Facebook,Twitter或新浪微博需要遵循哪些步骤?
我想在IOS 8.3上用SLServiceTypeFacebook在Facebook上分享文本.但弹出文本框显示为空.我希望它在文本中显示.您可以在下面看到我使用的代码.
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:@"First post from my iPhone app"];
[self presentViewController:controller animated:YES completion:Nil];
}
Run Code Online (Sandbox Code Playgroud) 我正在为iOS应用程序开发Twitter Feed视图.我找到了TWRequest,它的工作方式与我想要的完全相同.但是:我收到一条通知:"TWRequest已被弃用:首先在iOS 6.0中弃用".我应该用什么呢?
关于如何使用iOS社交框架获取Twitter OAuth令牌,我有点困惑.假设我在iOS6上设置了Facebook和Twitter帐户,我可以获得ACAccount.当我检查Facebook ACAccount的ACAccountCredential时,OAuthToken属性已设置,但对于Twitter ACAccount,则不是.Twitter ACAccount的每个其他细节都设置为ACAccountCredential不是.
为了增加混乱,我遇到了一篇关于使用Reverse Auth来获取OAuth令牌的文章(https://dev.twitter.com/docs/ios/using-reverse-auth).本文讨论调用https://api.twitter.com/oauth/request_token并传入oauth_*params params的字典,例如consumer_key,nononce等.但是,确实将我的ACAccount附加到SLRequest服务于此目的?无论如何,当我尝试这个时,我收到错误"无法验证oauth签名和令牌".
所以我的问题是我应该在ACAccountCredential中看到Twitter OAuth令牌,还是应该使用Reverse Auth?如果是这样,我是否需要显式传递包含oauth_*参数的NSDictionary或附加ACAccount足够?
我一直在使用新的Social.Framework,特别是SLRequest,它们都可以在iOS 6及更高版本上使用.事实上,我在尝试发布此类请求时遇到的崩溃让我感到非常惊讶.
我一直在使用Facebook和Twitter帐户崩溃,这就是为什么我知道它与其中一个特定问题无关.它必须与ACAccount对象相关,我以这种方式得到它:
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0")) {
//iOS 6
if (_twitterEnabled) {
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) {
//Set up account
[accountStore requestAccessToAccountsWithType:accountTypeTwitter options:nil completion:^(BOOL granted, NSError *error) {
if (granted && !error) {
//Get account and get ready to post.
NSArray *arrayOfAccounts = [accountStore accountsWithAccountType:accountTypeTwitter];
if ([arrayOfAccounts count] > 0) {
_twitterAccount = [arrayOfAccounts lastObject];
}
}
}];
}
}
if (!_facebookEnabled) {
ACAccountType *accountTypeFacebook = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
NSArray *permissions = @[@"user_about_me",@"user_likes",@"email"];
NSMutableDictionary *options = [NSMutableDictionary dictionaryWithObjectsAndKeys:kFacebookAppIDString, ACFacebookAppIdKey, …Run Code Online (Sandbox Code Playgroud) 我想写一个与Facebook紧密集成的应用程序.我不确定我使用的是什么 - 由Facebook提供的sdk或Apple提供的新社交框架.你知道它们的优点和缺点吗?
[编辑] 我最终使用Apple提供的社交框架,因为它更易于集成,它将在未来开发,并且我可以访问设备所有者Facebook帐户,因此用户在使用我的帐户时无需登录Facebook应用程序.我想做一些自定义的东西,所以我从ACAccountCredential获得oauth令牌,然后我用AFNetworing向Facebook的Graph API发出请求.
我正在尝试在iOS6中实现新的社交框架,并让它工作,除了2个奇怪的问题.如果我启用了我感兴趣的服务(例如...... FaceBook),那么它可以正常工作.但是,如果从设置面板中删除帐户(让我们说FaceBook,为了保持一致),那么我会在模拟器和设备中获得不同的,令人沮丧的行为.
这是我的视图控制器中的相关代码:
//Method for FaceBook
- (IBAction)doFacebook:(id)sender{
//check to see if facebook account exists
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
// Create the view controller defined in the .h file
fb=[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
// make the default string
NSString *FBString= [NSString
stringWithFormat:@"%@\r via #GibberishGenerator", gibText.text];
[fb setInitialText:FBString];
// show the controller
[self presentViewController:fb animated:YES completion:nil];
}
}
Run Code Online (Sandbox Code Playgroud)
在解雇上述方法时,这是一种奇怪的行为:
在模拟器(版本6.0(358.4)中,我得到对话框通知我没有使用"设置"和"取消"按钮设置任何faceBook帐户.点击"设置"只是取消对话框,但不带我到设置面板.
在运行6.01的iPhone 4s上,点击触发该方法的按钮会导致......什么都没有.换句话说,我没有通知对话通知我必须设置一个FaceBook帐户.
在此先感谢您的帮助.
这是我的新实现,基于user1734802的有用评论.
//Method for FaceBook
- (IBAction)doFacebook:(id)sender{
// Create the view controller defined in the .h …Run Code Online (Sandbox Code Playgroud) 我正在开发Facebook社交媒体应用程序.我的应用程序支持iOS 5和iOS 6,我想使用原生的facebook来邀请朋友.
在iOS 5中,使用图形api可以正常工作.在iOS 6中,苹果增加了新功能,我们可以将Facebook本身用作推特.所以我们不需要从我们的应用程序登录它将从iOS 6的设置iphone屏幕获取凭据.
因此,我必须使用社交框架,因为我们在twitter中使用.我成功地使用Facebook图像共享的本地对话框,并在Twitter中看起来像.
现在我想使用本地对话框(社交框架)邀请Facebook上的朋友.
我不知道如何使用社交框架邀请iOS6中的朋友.
我搜索了很多,但找不到任何解决方案,即使我不知道是否可能?
如果有人有这样的样品项目或好主意,请通知我.
我希望你理解我的问题......
如果没有请告诉我..
嗨,我想从iOS 6中的ACAccountStore获取Facebook用户的UID
self.accountStore = [[ACAccountStore alloc]init];
ACAccountType *FBaccountType= [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSString *key = @"01234567890123";
NSDictionary *dictFB = [NSDictionary dictionaryWithObjectsAndKeys:key,ACFacebookAppIdKey,@[@"email"],ACFacebookPermissionsKey, nil];
[self.accountStore requestAccessToAccountsWithType:FBaccountType options:dictFB completion:
^(BOOL granted, NSError *e) {
if (granted) {
NSArray *accounts = [self.accountStore accountsWithAccountType:FBaccountType];
//it will always be the last object with single sign on
self.facebookAccount = [accounts lastObject];
//i Want to get the Facebook UID and log it here
NSLog(@"facebook account =%@",self.facebookAccount);
} else {
//Fail gracefully...
NSLog(@"error getting permission %@",e);
}
}];
Run Code Online (Sandbox Code Playgroud)
self.facebookAccount …