iOS 7 iAd interstitial ads can not be closed by user - ios7

when i display interstitial ads with
[interstitial presentFromViewController:self];
i get the warning that this method is deprecated in iOS 7. But it still works fine!
When i display the ad view with
[self requestInterstitialAdPresentation];
[interstitial presentInView:self.view];
i get no warning and the ad is loading but there is no (X) in the ad that the user can close the ad.
Do somebody knows how to fix this?

hey there this is the troublemaker
[interstitial presentInView:self.view];
instead try this (delegate methods) t'should be removed manualy
-(void)interstitialAdDidLoad:(ADInterstitialAd *)interstitialAd{
if (interstitial != nil){
_adPlaceholderView = [[UIView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:_adPlaceholderView];
[interstitial presentInView:_adPlaceholderView];
}
and on did unload
- (void)interstitialAdDidUnload:(ADInterstitialAd *)interstitialAd
{
NSLog(#"ad has been unloaded");
[_adPlaceholderView removeFromSuperview];
_adPlaceholderView = nil;
}
I have the same bug Use the old API or put custom x button .I thinks this is a bug from presentinView . i am not sure it could be apple desired feature there's no documentation on this.At least i haven't seen any.Please share if you find something official on this.

Related

Camera Rotation and OverlayView in iOS8

I am experiencing an issue when using the iPad Camera in iOS 8. I've seen some older questions and a thread on the Apple Developer Forums from during the beta but still haven't find a solution.
There seems to be two parts to this issue.
1) The camera itself rotates when the device orientation rotates, eg the world is on its side
2) When opening the camera in Landscape, the overlay does not appear. When opened in Portrait it is fine.
It is an app using iOS7 as the Base SDK, problem only occurs when running the app on a device that has been upgraded to iOS8. The app is not using storyboards, it is using nibs.
I'm hoping to push out a fix for this with Xcode 5.1.1 before moving onto the iOS8 specific fixes and using it as a Base SDK in the next version.
Here is my code to bring up the camera:
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] == YES) {
// Create Camera
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
imagePicker.showsCameraControls = NO;
// Set up custom controls view
[[NSBundle mainBundle] loadNibNamed:#"OverlayView" owner:self options:nil];
self.overlayView.frame = imagePicker.cameraOverlayView.frame;
imagePicker.cameraOverlayView = self.overlayView;
self.overlayView = nil;
// Show Camera
[self presentViewController:imagePicker animated:NO completion:nil];
[imagePicker release];
}
I have also tried
And the Layout of the Toolbar (sitting at the bottom) of the OverlayView:
If I change that to sit "at the top" it appears in both portrait and landscape! So it must have to do with the view/window/something size, though it's strange how its behaviour would change when the layout has stayed the same.
I have tried it with both showsCameraControls = YES and hashing out the OverlayView block, and problem #1 persists so it's not to do with the overlay at app.
I'm hoping someone has found an answer to this, it seems like quite a common problem.
Please let me know if you need any further details.
Edit 1: Fixed the Overlay (Issue #2)
It wasn't applying the orientation to the OverlayView, fixed it like this:
// Grab the window frame and adjust it for orientation - from http://stackoverflow.com/a/15707997/520902
UIView *rootView = [[[UIApplication sharedApplication] keyWindow]
rootViewController].view;
CGRect originalFrame = [[UIScreen mainScreen] bounds];
CGRect screenFrame = [rootView convertRect:originalFrame fromView:nil];
...
self.overlayView.frame = imagePicker.cameraOverlayView.frame;
I suspect that it's related to the camera not realising it's orientated too, will keep searching for a fix for Problem #1.
Edit 2: Update on Issue #1
Looks like the camera rotating might be an Apple issue. On iOS8 if you open up the Contacts app, edit a contact and choose 'Take Photo', the exact same issue occurs - in a default Apple app!
I still can't find a fix so I am just destroying and recreating the imagePicker on each orientation change for now, it's ugly but will suffice until Apple release a fix or a better solution pops up.
Apple fixed this problem in iOS 8.1.

Why does UIImagePickerController NOT sort most recent photos first when using UIImagePickerControllerSourceTypePhotoLibrary?

EDIT: After updating to iOS 7.0.3 the problem is gone
I would like the UIImagePickerController to display photos in a way that the user can access most recent photos first (I am working with iOS7).
I am following this answer https://stackoverflow.com/a/10023924/2007515 , so my function looks like:
- (IBAction)action_album:(id)sender
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
[self presentViewController:picker animated:YES completion:nil];
}
But the result is not what I want:
the "Photos" overview is presented (good)
if I pick "Camera Roll" the oldest photos are displayed on top and I have to scroll all the way down to get the most recent ones (not good)
Could someone tell me what I'm missing here? Thank you.
Just figured this out. This seems to be some kind of Apple bug. If your statusbar is hidden when using the UIImagePickerController, the image picker does not automatically scroll to the bottom (newest) and stays at the top (oldest). If I let the status bar show when using the image picker, it auto scrolls to the bottom like it should. Thanks a lot, Apple.

Need to post to facebook and twitter from an ios app

I've been doing some research on how to post to fb and to twitter... I know there is a library called Sharekit and I also know I can post using the new iOS6 feature SLComposeViewController... I just need to post a text, that's all... It's not necessary that the user can edit the message...
I need some advice, what would you use?
If you're ok supporting only iOS6, SLComposeViewController is probably easiest. On the Facebook side, you lose nice little features offered via the Facebook SDK for iOS (e.g., the ability to have the Facebook post bear some indication that it came from your app, the graceful inclusion of both images and URLs, etc.).
Bottom line, if you're ok with iOS6-only and you want to keep it simple, SLComposeViewController is probably easiest and can do both Twitter and Facebook. If you want to make the most of Facebook or if you have to support iOS 5, you really have to pursue the Facebook SDK, but it takes a little more code. On the Twitter side, if you need to support iOS 5, then you need to use TWTweetComposeViewController.
Try this one:
- (IBAction)share:(id)sender
{
NSString *text = #"Your message";
UIImage *image = [UIImage imageNamed:#"yourimage.png"];
NSArray *items = [NSArray arrayWithObjects:text,image , nil];
UIActivityViewController *avc = [[avcClass alloc] initWithActivityItems:items applicationActivities:nil];
avc.excludedActivityTypes = #[UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact,UIActivityTypeSaveToCameraRoll, UIActivityTypeMessage, UIActivityTypeMail];
[self presentViewController:avc animated:YES completion:nil];
}
This should work for you. Just set the NSString and if you want an image.
No frameworks needed!

Implementing iAd Banner

I just published an application on the App Store with an iAd banner. When I downloaded it to check for the advertisement, I just saw a plain white horizontal rectangle even though it says "Live: This app is receiving live ads." in development.
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
[adView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierLandscape];
[adView setDelegate:self];
[self.view addSubview:adView];
[self.view bringSubviewToFront:adView];
- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
{
return YES;
}
Everything in my performance chart is zero, except for the 715 requests. What does this mean?
Also, is it possible for iAd to determine the user's location so that apple can put ads from local companies? For example, the user is in Japan, will iAd only show ads from Japan?
Does it work in the simulator, i don't think it's a programming error but rather a technical error from apples side. Manny developers is experiencing this:
Can not see iAd in program?
I think there is no ad available so your app receives a nil value. I don't see any check for that, so regardless if it's nil or not, your app tries to display what it got, which may be nil. So you end up with a blank ad with no link what you see there.
I suggest in the next version to check for that and/or use some fallback method like AdMob or something.
You need to check if your ADBannerView received an ad or not and then display or hide it accordingly.
-(void)bannerViewDidLoadAd:(ADBannerView *)banner {
// Display banner
adView.alpha = 1.0;
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
// Hide banner
adView.alpha = 0.0;
}

ZXingWidgetController shows a blank screen when loaded

I am using Xcode 4.1, on iOS Simulator 4.3
I have imported the ZXing library into my project as per the instructions in their README.
When I try to load the controller all I see is a white screen with a Cancel button at the bottom. I know the simulator can't take photos but the controller is then supposed to let you choose an image to decode from the photo library. Has anyone had this issue or has any ideas on what is causing it?
ZXingWidgetController *widController = [[ZXingWidgetController alloc] initWithDelegate:self showCancel:YES OneDMode:NO];
QRCodeReader* qrcodeReader = [[QRCodeReader alloc] init];
NSSet *readers = [[NSSet alloc ] initWithObjects:qrcodeReader,nil];
[qrcodeReader release];
widController.readers = readers;
[readers release];
[self presentModalViewController:widController animated:YES];
[widController release];
EDIT: Forgot to mention, there are pictures on the simulator that I loaded already.
but the controller is then supposed to let you choose an image to
decode from the photo library
Where did you see this? It's not in the README or the code.
The widget doesn't provide an image picker backup. The old Barcodes app (found in cpp/iphone/legacy/Barcodes_original) did but the current Barcodes app doesn't. If you need this, you'll have to implement it yourself. The old Barcodes app might be useful as guide, to some extent.