Xcode - crash opening camara on ipad - xcode

My iphone app use camara to take photo.
Installing the app on ipad, the access to camara make the app crash.
Someone knows if any difference exists on use the picker controller between iphone and ipad?
Tx in advance
---EDIT---
he codeo that thaht call the camara I using is:
- (void) showCamera{
UIImagePickerController * imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.allowsEditing =YES;
[self presentViewController:imagePickerController animated:YES completion:nil];
}

Related

Admob banner not filling up full screen

My app was just released the other day. When I downloaded it to an iPhone 6 I noticed the admob banner didn't fill the full screen (look at the attached picture). The banner works fine on an iPad and iPhone 5 but isn't working correctly on the iPhone 6.
Here is my code I am using for the banner:
_bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait];
_bannerView_.frame = CGRectMake(0.0,
self.view.frame.size.height -
_bannerView_.frame.size.height,
_bannerView_.frame.size.width,
_bannerView_.frame.size.height);
_bannerView_.adUnitID = #"ID";
_bannerView_.rootViewController = self;
GADRequest *request = [GADRequest request];
[_bannerView_ loadRequest:request];
[self.view addSubview:_bannerView_];
Does anyone see any problems or know how to fix this problem? Thanks in advance
I used below code to create Admob Banner. It worked fine in iPhone6 also.
-(void)createBannerAds
{
//set up banner coordinates to display at the bottom
CGPoint origin = CGPointMake(0.0,self.view.frame.size.height -kGADAdSizeSmartBannerPortrait.size.height);
self.adBanner = [[[DFPBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait origin:origin] autorelease];
self.adBanner.adUnitID = ADMOB_ID;
self.adBanner.delegate = self;
[self.adBanner setRootViewController:self];
[self.view addSubview:self.adBanner];
GADRequest *request = [GADRequest request];
request.testDevices = #[#"600ecccd6a1c2a4750952facf253ea2f"];
[self.adBanner loadRequest:request];
}

Can't figure out how to get UpSide down orientation to work in iOS 8?

I added UIScreen bounds code in AppDelegate.m for iPhone 6 and now device orientation for iPhone 6 won't work for Portrait/ Upside Down. Upside Down is what's not working in simulator and devices.
Code in AppDelegate.m
CGSize iosScreenSize = [[UIScreen mainScreen] bounds].size;
if (iosScreenSize.height == 667) {
UIStoryboard *iPhone6 = [UIStoryboard storyboardWithName:#"iPhone6" bundle:nil];
UIViewController *initialViewController =[iPhone6 instantiateInitialViewController];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen]bounds]];
self.window.rootViewController = initialViewController;
[self.window makeKeyAndVisible];
}
When I included the above code the simulator and device for iPhone 6 doesn't detect Upside Down orientation. I also used nativeBounds and screenBounds, didn't work either for Upside Down orientation.
My code for device orientation...
-(NSUInteger)supportedInterfaceOrientations {
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
}
I have no idea what to do to get AppDelegate code to let UpSide Down orientation be detected for iPhone 6.
OK, finally figured this one out.
Then realized someone posted the answer here: Setting device orientation in Swift iOS
Go down to DaRk-_-D0G's answer.
I had to subclass my tab bar controller just to override that method. Very obnoxious .

Presenting UIImagePickerController over modally presented view controller does not work correctly in iOS 8

I have presented UIImagePickerController from modally presented view controller. After clicking the image I get a black image instead of the clicked picture
I did something Like this.
//From ViewController1 I presented view controller2 with
- (IBAction)buttontappedToPresentViewController2:(id)sender
{
ViewController2* controller2 = [[ViewController2 alloc] initWithNibName:#"ViewController2" bundle:nil];
controller2.modalPresentationStyle = UIModalPresentationPageSheet;
[self controller2 animated:YES completion:nil];
}
//In ViewController2, I presented the UIIMagePickerController
- (IBAction)cameraButtonTapped:(id)sender
{
UIImagePickerController *cameraController = [[UIImagePickerController alloc] init];
cameraController.mediaTypes = #[(NSString *)kUTTypeImage,(NSString*)kUTTypeMovie];
cameraController.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:cameraController animated:YES completion:NULL];
}
After clicking the image you will get black screen instead of the captured image with retake and use photo options. If you select "Use Photo" option you get the correct image in callback.
Note: If you do not set UIModalPresentationStyle for viewController2, the code works fine.
Any idea what is going wrong here.
EDIT: I have used XCODE 5.1 and my target deployment is iOS 7. I am running the app on iOS8 device.

xcode iOS6 orientation landscape

I see a lot of questions about this subject but am unable to find a solution to the problem I am experiencing. I have created an iPad app that should be Landscape only - it works fine when ran on any os prior to iOS6 but on iOS6 the app opens in portrait view. This screenshot shows what I mean (sorry not a great explanation) http://s1342.beta.photobucket.com/user/designedbyria/media/ScreenShot2012-11-02at122113.png.html
I'm guessing the problem is somewhere in the below code, but I can't be sure. I have set the supported Interface Orientations to Landscape Left and Landscape Right only - but this has not worked. I have also taken a look at the questions here with no luck..
I am using xcode and cordova/phonegap
Interface orientation in iOS 6.0
Set orientation to landscape mode in xcode 4.5 GM IOS 6
iOS 6 apps - how to deal with iPhone 5 screen size?
Thanks in Advance!
/**
* This is main kick off after the app inits, the views and Settings are setup here. (preferred - iOS4 and up)
/
- (BOOL) application:(UIApplication)application didFinishLaunchingWithOptions: (NSDictionary*)launchOptions {
NSURL* url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
NSString* invokeString = nil;
if (url && [url isKindOfClass:[NSURL class]]) {
invokeString = [url absoluteString]; NSLog(#"iwill launchOptions = %#", url);
}
CGRect screenBounds = [[UIScreen mainScreen] bounds];
self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease];
self.window.autoresizesSubviews = YES;
CGRect viewBounds = [[UIScreen mainScreen] applicationFrame];
self.viewController = [[[MainViewController alloc] init] autorelease];
self.viewController.useSplashScreen = YES;
self.viewController.wwwFolderName = #"www";
self.viewController.startPage = #"index.html";
self.viewController.invokeString = invokeString;
self.viewController.view.frame = viewBounds;
// check whether the current orientation is supported: if it is, keep it, rather than forcing a rotation
BOOL forceStartupRotation = YES;
UIDeviceOrientation curDevOrientation = [[UIDevice currentDevice] orientation];
if (UIDeviceOrientationUnknown == UIInterfaceOrientationLandscapeLeft) {
// UIDevice isn't firing orientation notifications yet… go look at the status bar
curDevOrientation = (UIDeviceOrientation)[[UIApplication sharedApplication] statusBarOrientation];
}
if (UIDeviceOrientationIsValidInterfaceOrientation(curDevOrientation)) {
for (NSNumber *orient in self.viewController.supportedOrientations) {
if ([orient intValue] == curDevOrientation) {
forceStartupRotation = YES;
break;
}
}
}
if (forceStartupRotation) {
NSLog(#"supportedOrientations: %#", self.viewController.supportedOrientations);
// The first item in the supportedOrientations array is the start orientation (guaranteed to be at least Portrait)
UIInterfaceOrientation newOrient = [[self.viewController.supportedOrientations objectAtIndex:0]
intValue];
NSLog(#"AppDelegate forcing status bar to: %d from: %d", newOrient, curDevOrientation);
[[UIApplication sharedApplication] setStatusBarOrientation:newOrient];
}
[self.window addSubview:self.viewController.view];
[self.window makeKeyAndVisible];
return YES; }
I had the same problem (but not using cordova/phonegap).
You have to set your view controller as a RootViewController in your appDelegate instead of just adding as a subview.
Replace in you appdelegate:
[self.window addSubview:self.viewController.view];
[self.window makeKeyAndVisible];
By
[self.window setRootViewController:self.viewController];
[self.window makeKeyAndVisible];
You can use the delegate
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeLeft;
}
Using this delegate and the application will be present in Landscape mode or any desired orientation mode.
Try it.

Crash on iOS6 presentViewController: but not on iOS5

This code is crashing when i run my app on iOS6 Simulator with Xcode 4.5 GM Seeds:
if ([[[UIDevice currentDevice] systemVersion] isEqualToString:#"6.0"]) {
XLog(#"hier checken");
self.tabBarController = [[UITabBarController alloc] init];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
}
[...]
self.loginController = [[[LoginController alloc] initWithNibName:#"LoginController_iPhone" bundle:nil] autorelease];
self.loginController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
//this line occurs a crash on iOS 6 (simulator, device not tested)
[self.tabBarController presentViewController:self.loginController
animated:YES
completion:nil];
The crash is a SIGABRT. no more information about the crash.
what is occuring this crash on iOS6?
initWithNibName:bundle: is the designated initializer for a UIViewController,and there is something new in iOS6 .
You can try to modify your LoginController_iPhone.xib and remove its controller :
---->
It works for me .
hope this helps.
An app i was working on, would crash without any trace when I was trying to access the address book. ABAddressBookRef or ABAddressBookCreate with the permission for your app to access Contacts turned off, will crash the app. Hope this helps!

Resources