https://nplink.net/gkkmz0c0

https://nplink.net/gkkmz0c0

Tuesday, May 10, 2016

ربط المدونة بالفيس بوك

// Import the SDK header file and declare that you are implementing
// the FBAdViewDelegate protocol:
#import <FBAudienceNetwork/FBAudienceNetwork.h>

@interface MyViewController : UIViewController <FBAdViewDelegate>
  // Other code might go here...
@end
       
// In your View Controller, create a new instance of the FBAdView
// and add it to your view hierarchy:
- (void)viewDidLoad
{
  [super viewDidLoad];

  FBAdView *adView =
    [[FBAdView alloc] initWithPlacementID:@"353944478062981_353945798062849"
                                   adSize:kFBAdSize320x50
                       rootViewController:self];

  adView.delegate = self;

  [adView loadAd];

  // Reposition the adView
  // ...

  [self.view addSubview:adView];
}

// Now that you have the basic code running, it is recommended that you use
// the FBAdView delegate to get notified when the ad fails to load so you
// could hide the banner unit. In the same way, you can add it back when it
// was loaded:
- (void)adView:(FBAdView *)adView didFailWithError:(NSError *)error;
{
  NSLog(@"Ad failed to load");
  // Add code to hide the ad unit...
  // E.g. adView.hidden = YES;
}

- (void)adViewDidLoad:(FBAdView *)adView;
{
  NSLog(@"Ad was loaded and ready to be displayed");
  // Add code to show the ad unit...
  // E.g. adView.hidden = NO;
}

No comments: