0

I am trying to lunch Aviary SDK photo editor in landscape mode , but it works only on iPad !! , my app crashes on iPhone due this problem :

'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'

I tried different ways but no success :

- (IBAction)photoEditor:(id)sender {

    [self displayEditorForImage:imageBG.image];

}


- (void)displayEditorForImage:(UIImage *)imageToEdit
{
 //set device orientation 

    [AFPhotoEditorCustomization setSupportedIpadOrientations:@[@(UIInterfaceOrientationLandscapeRight),
     @(UIInterfaceOrientationLandscapeLeft) ]];


    AFPhotoEditorController *editorController = [[AFPhotoEditorController alloc] initWithImage:imageToEdit];
    [editorController setDelegate:self];

    [self presentViewController:editorController animated:YES completion:nil];
}

none of these codes worked :

1-

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return ( (interfaceOrientation == UIInterfaceOrientationLandscapeRight) ||
            (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) );
}

2-

-(BOOL)shouldAutorotate
{
    return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft;;
}

3-

-(NSUInteger)supportedInterfaceOrientations
 {
 return UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationLandscapeLeft; // add any other you want
 }



-(BOOL)shouldAutorotate
{

//tried NO too , 
    return YES ;

  }

my app is running on iOS 6 , appreciate for any help

rmaddy
  • 314,917
  • 42
  • 532
  • 579
iOS.Lover
  • 5,923
  • 21
  • 90
  • 162

1 Answers1

2

From Aviary FAQ:

Q: How do I change the supported orientations for the editor?

A: On the iPhone form factor, the Editor is restricted to Portrait presentation only. [...]

That means what you want is impossible. The editor must run in Portrait mode.

Community
  • 1
  • 1
Sulthan
  • 128,090
  • 22
  • 218
  • 270
  • Still crashes !! I even made a subclass and set shouldRotate to NO ! but still crashes ! – iOS.Lover Jul 25 '13 at 11:15
  • 1
    @Mc.Lover That's intented behavior. The SDK just cannot run in landscape mode. You have to add `UIInterfaceOrientationPortrait` to the supported orientations. – Sulthan Jul 25 '13 at 11:25
  • @SulthanIs Is there anyway to uncheck Portrait in supported orientations ? because my app runs in only Landscape mode if I check this option screen rotates and `shouldAutoRotate` and other screen rotation lock codes won't work !!!! – iOS.Lover Jul 26 '13 at 11:57