I managed to push an ABNewPersonViewController to my navigation controller. However I encountered this error when I'm selecting "Add photo" -> "Choose Photo":
* Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'
This error is caused to due the fact that I want my iPad application to have landscape-only orientation.
Any idea how to solve this problem ? Many thanks !
Hope this helps anyone who has problem with this:
# App Delegate, add this line of code
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
return UIInterfaceOrientationMaskAll;
}
# Your view, add this line of code
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
This will make Photo selector view thinks that it has UIInterfaceOrientationMaskPortrait, and yet the application still remains as landscape! Voila!
Related
I have developed a game in cocos2d and all game screens are in Landscape mode. I am trying to implement game Center but getting crash on authentication. I did not find answer of similar type of issues. please suggest right approach...
Crash issue:-'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'
I tried below solution but it also disturb game orientations, game starts work in portrait mode also, that i don't want:-
(NSUInteger)application:(UIApplication*)application
supportedInterfaceOrientationsForWindow: (UIWindow*)window
{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
Make sure you selected landscape in Xcode summary page.
Also add these code in your viewcontroller
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
Update this function in AppDelegate:
- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
{
return UIInterfaceOrientationMaskLandscape;
}
the solution for that is short, i spent a lot of time before finding it:
in the AppDelegate in the method didFinishLaunchingWithOptions put this line:
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];
obviously before call the login game center method, i put that before create the UIWindows
I have implemented a simple segue from a button click. Here is the view controller code:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
{
if (self.categoryInt == 1)
[segue.destinationViewController setCategoryKey:SD_ADDITION];
else if (self.categoryInt == 2)
[segue.destinationViewController setCategoryKey:SD_SUBTRACTION];
}}
- (IBAction)category1Selected:(id)sender {
self.categoryInt = 1;
[self performSegueWithIdentifier:#"ShowWorksheet" sender:self];}
From the log messages, I can see that it ran through the ViewDidLoad on the destinationviewcontroller completely but then it errors out
with: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MainMenuViewController categorySelected:]: unrecognized selector sent to instance 0x75360e0'
I have not implemented any specific selectors on these buttons. Also there is no "categorySelected" method in my MainMenuViewController. The method being invoked is "category1Selected". What is causing this error?
I think you answered the question yourself. You are somehow sending "categorySelected" when you SHOULD be sending category1Selected.
Check to see if you previously wired a button to categorySelected in interface builder. If you had previously done this, but then changed the name of categorySelected to category1Selected in your code, interface builder would probably not update.
This is usually a connection error, go to your connections inspector and make sure all is correct there.
If your not sure disconnect all the connections and re make the connections double checking everything.
Also Make sure you haven't connected the action button as an outlet in addition to its action command.
I'm working on a project and just update to Xcode 4.5 and i'm using iOS 6 simulator.
Now i'm getting the following error:
Terminating app due to uncaught exception
'NSInternalInconsistencyException', reason: '-[UITableViewController
loadView] loaded the "FeedController" nib but didn't get a
UITableView.'
It's strange cause I do not have any NIB file for this controller since it is only a table:
#interface FeedController : UITableViewController <EGORefreshTableHeaderDelegate>
- (void)reloadTableViewDataSource;
- (void)doneLoadingTableViewData;
#end
This controller is loaded from a Tab Controller, it alloc the FeedController without problem, but when you press the tab button to show the feed it crashes with that error.
It was working good on ios4 and ios5 simulators and devices.
Clean & Build project didn't help.
Anyone with same problem?
Does the answer listed here help? nib but didn't get a UITableView
If not, is your UITabBarController created from a NIB that somehow specifies a non-UITableView view for the FeedController tab?
You'll have to add this:
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
I have a master-detail app that is working great for the iPad. However, the iPhone version doesn't work because a variable that is being sent to the DetailViewController in the iPad version doesn't send to the iPhone DetailViewController. I can fix this with a single line of code in MasterViewController implementation:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
self.detailViewController=segue.destinationViewController;
}
Unfortunately, when I implement that code, the iPad version stops working. I get an exception when I go from another view controller (HomeViewController) back to DetailViewController. That error log is:
2012-07-14 14:29:12.924 46 Tracker[2772:11603] -[HomeViewController setDetailItem:]: unrecognized selector sent to instance 0x7cad4f0
2012-07-14 14:29:12.925 46 Tracker[2772:11603] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[HomeViewController setDetailItem:]: unrecognized selector sent to instance 0x7cad4f0'
*** First throw call stack:
(0x148a022 0x201acd6 0x148bcbd 0x13f0ed0 0x13f0cb2 0x2cb0 0x2d75c5 0x2d77fa 0xb6c85d 0x145e936 0x145e3d7 0x13c1790 0x13c0d84 0x13c0c9b 0x16a07d8 0x16a088a 0x246626 0x1fdd 0x1f45)
terminate called throwing an exception(lldb)
So, is there any way I can run that first block of code only when the user is on the iPhone? Or, can I fix the code to make it work properly on both devices?
Here is a link to my iPad storyboard to (hopefully) make it more clear. I have a problem when I click on a table cell AFTER going from HomeViewController back to DetailViewController: http://www.grapekeeper.com/storyboards.png
Perhaps the following?
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
// perform iPad logic
} else {
// perform iPhone logic
}
Really basic question here:
I want to build an app that has a bunch of MasterDetail views that can be accessed from a TabView.
I'd like to start with the MasterDetail project template, but if I do that and toss a TabController onto the front of the storyboard, I get a crash.
2012-04-08 12:51:21.205 SMToolkit[22630:fb03] -[UISplitViewController topViewController]: unrecognized selector sent to instance 0x82491c0
2012-04-08 12:51:21.208 SMToolkit[22630:fb03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UISplitViewController topViewController]: unrecognized selector sent to instance 0x82491c0'
*** First throw call stack:
(0x16ad022 0x183ecd6 0x16aecbd 0x1613ed0 0x1613cb2 0x2bf9 0x16386 0x17274 0x26183 0x26c38 0x1a634 0x1597ef5 0x1681195 0x15e5ff2 0x15e48da 0x15e3d84 0x15e3c9b 0x16c65 0x18626 0x2a6d 0x29d5)
terminate called throwing an exception(lldb)
All I've done so far is in the storyboard (literally I made a new MasterDetail project, then went into the storyboard and put a tabcontroller in front of it)
Simple answer is that the template provided for you in Master Detail includes some code you probably don't want.
In AppDelegate.m look for the following method and simply have it return YES;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
return YES;
}