有没有办法检查用户是否实际登录到操作系统中的Facebook或Twitter.
我想这样做的原因是通过例如使用facebooks SDK来共享应用程序,而不是要求用户再次登录.
我实际上认为代码:
[SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook];
Run Code Online (Sandbox Code Playgroud)
确切地说,但是如果用户没有登录,它显然只会显示警报.
仅当用户未安装Facebook应用程序,未在操作系统中登录(在设置中),而是通过Facebook SDK登录到我们的应用程序时,才会出现这种情况.
我想将视频文件发布到Facebook.以前我使用Facebook iOS SDK3.0,它的工作原理.但是,对于iOS6社交框架,存在问题.
__block ACAccount * facebookAccount;
ACAccountStore* accountStore = [[ACAccountStore alloc] init];
NSDictionary *options = @{
ACFacebookAppIdKey: @"MY APP ID",
ACFacebookPermissionsKey: @[@"publish_actions", ],
@"ACFacebookAudienceKey": ACFacebookAudienceFriends
};
ACAccountType *facebookAccountType = [accountStore
accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
[accountStore requestAccessToAccountsWithType:facebookAccountType options:options completion:^(BOOL granted, NSError *error) {
if (granted) {
NSArray *accounts = [accountStore
accountsWithAccountType:facebookAccountType];
facebookAccount = [accounts lastObject];
NSLog(@"access to facebook account ok %@", facebookAccount.username);
NSData *videoData = [NSData dataWithContentsOfFile:[self videoFileFullPath]];
NSLog(@"video size = %d", [videoData length]);
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
videoData, @"video.mov",
@"video/quicktime", @"contentType" …Run Code Online (Sandbox Code Playgroud) 根据我的阅读,在iOS 5中,您可以使用以下方法调用"设置"应用:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General"]]
Run Code Online (Sandbox Code Playgroud)
但在iOS 5.1中它已不再可用.
但是,在iOS 6中,在社交框架中,您可以使用Facebook和Twitter执行此操作.当您需要为邮件设置帐户时,有没有办法复制这个?
嗨,我是iOS开发的新手.我创建了名为socialClass.h的类
#import <Social/Social.h>
#import <Accounts/Accounts.h>
- (void)facebookSharingStatusCheckCall:(NSString *)url image:(NSString *)img status:(NSString *)text viewCont:(UIViewController *)uiVew;
- (void)facebookForIosSix:(NSString *)url image:(NSString *)img status:(NSString *)text viewCont:(UIViewController *)uiVew;
Run Code Online (Sandbox Code Playgroud)
并在socialClass.m
- (void)facebookSharingStatusCheckCall:(NSString *)url image:(NSString *)img status:(NSString *)text viewCont:(UIViewController *)uiVew
{
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
NSLog(@"service available");
[self facebookForIosSix:url image:img status:text viewCont:uiVew];
} else {
// facebook for iOS 5 function will be called here
}
}
-(void)facebookForIosSix:(NSString *)url image:(NSString *)img status:(NSString *)text viewCont:(UIViewController *)uiVew
{
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *fbcontroller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
SLComposeViewControllerCompletionHandler myBlock = …Run Code Online (Sandbox Code Playgroud) 我正在做登录功能.其中 -
用户将提供Twitter电子邮件ID登录,如果登录成功,我的应用程序将导航用户到我的应用程序的内部屏幕.
如果用户已从用户的设备ios设置配置了Twitter帐户.我的应用程序从那里获取用户的电子邮件ID,它将导航到我的应用程序的第二个屏幕.
如果用户尚未从ios设置配置Twitter帐户,那么,如果用户在我的应用程序登录屏幕上通过Twitter登录按钮,则会将用户导航到用户必须提供电子邮件ID(推特ID)和密码的推特页面.登录成功它应该回到我的应用程序的内部屏幕(与登录Facebook的功能相同).
我怎么能做到这一点.提前致谢.
我正在开发两个不同的iOS应用程序:
所以尽管我试图关注各种帖子,文档等,但我做错了.
我特意按照这个帖子iOS 6 Facebook发布程序最终以"remote_app_id与存储的id不匹配"错误,它有一个非常好的答案.
我想我已经在Facebook开发者中创建了我的应用程序,因为我遇到了问题(错误的iPhone ID和错误7),并且在帖子之后我提到这些问题消失了.
当用户点击Facebook上的分享时,我这样做:
- (void) loginWithFacebookWithReadPermissionsWithDelegate:(id<IfcRRSSDelegate>)_delegate
{
self.delegateFB = _delegate;
ACAccountStore *account = [[ACAccountStore alloc]init];
ACAccountType *accountType = [cuenta accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSString *facebookKey = MY_FACEBOOK_KEY;
NSMutableArray *permimssions = [[NSMutableArray alloc] init];
[permimssions addObject:@"email"];
self.fbPermission = [NSMutableDictionary dictionaryWithObjectsAndKeys:
facebookKey, ACFacebookAppIdKey,
ACFacebookAudienceFriends, ACFacebookAudienceKey,
permimssions, ACFacebookPermissionsKey,
nil];
[account requestAccessToAccountsWithType:accountType options:self.fbPermission completion:
^(BOOL granted, NSError *error) {
if(granted)
{
NSArray *accounts = [account accountsWithAccountType: accountType];
ACAccount *_facebookAccount = [accounts lastObject];
self.accountFB = _facebookAccount; …Run Code Online (Sandbox Code Playgroud) 我还没有在我的代码中使用Social框架,我只是将它导入到项目中.这导致它在iOS 5上崩溃,因为尚未支持Social框架.如何以我的iOS 5用户仍然无需启动应用程序的方式导入它?