如何在支持iOS 4.3及更高版本的应用程序中集成Facebook的移动广告功能? [英] How to integrate Facebook's mobile ad functionality in our app that supports iOS 4.3+?
问题描述
我正在尝试为我的公司设置此设置: https://developers.facebook.com/docs/tutorials/mobile-app-广告/
I'm trying to get this set up for my company: https://developers.facebook.com/docs/tutorials/mobile-app-ads/
我按照此处的说明将其放入我们的应用中: https://developers.facebook.com/docs/入门/facebook-sdk-for-ios/3.1/
I used the instructions here to get it into our app: https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/3.1/
从我最初的整合和获取数据的尝试来看,这似乎仅适用于iOS 6.
当我为iOS 6模拟器运行该应用程序时,它运行良好,但是对于运行iOS 5的实际设备,它在链接期间失败:
ld:未找到社交框架
From my initial attempt to integrate and get data, it seems like this can only work for iOS 6.
When I run the app for iOS 6 simulator it runs fine, but for an actual device running iOS 5, it fails during linking:
ld: framework not found Social
此FB SDK功能仅在iOS 6+应用程序中有效吗? 如果是这样,是否有人知道如何与支持iOS 4.3到iOS 6+的应用程序的FB移动广告报告集成.
Is it true that this FB SDK functionality can only work in iOS 6+ apps? If so, does anyone know how to integrate with FB mobile ads reporting for apps that support iOS 4.3 to iOS 6+.
谢谢!
推荐答案
新的SDK实际上需要6.
The new SDK actually requires 6.
不确定是什么原因导致了错误,但是为了消除构建问题,我只是清理了构建文件夹,从项目中删除了派生数据,并删除了&重新添加了Facebook库.
Not sure what was causing the error, but to eliminate the build problem, I just cleaned the build folder, deleted the derived data from the project, and removed & re-added the facebook libs.
然后为了防止在iOS 6之前的版本中出现这种情况,我将其添加到了我的应用中:
Then to prevent this from blowing up on pre-iOS 6 situations I added this to my app:
+ (BOOL)isSocialFrameworkAvailable
{
static BOOL available = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
available = NSClassFromString(@"SLComposeViewController") != nil;
});
return available;
}
- (BOOL)application: (UIApplication *) application didFinishLaunchingWithOptions: (NSDictionary *) launchOptions
{
// [...]
if ([[self class] isSocialFrameworkAvailable]) {
[FBSettings setLoggingBehavior:[NSSet setWithObjects:
FBLoggingBehaviorFBRequests,
FBLoggingBehaviorFBURLConnections,
FBLoggingBehaviorAccessTokens,
FBLoggingBehaviorPerformanceCharacteristics,
FBLoggingBehaviorSessionStateTransitions,
nil]];
NSDate *facebookIdPublishedDate = [[NSUserDefaults standardUserDefaults] objectForKey:@"facebookIdPublishedDate"];
if (!facebookIdPublishedDate) {
[[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:@"facebookIdPublishedDate"];
[FBSettings publishInstall:@"XXXXXXXXXXXXXXXX"];
}
}
// [...]
}
这篇关于如何在支持iOS 4.3及更高版本的应用程序中集成Facebook的移动广告功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!