Tag: 层次结构

警告:尝试使用SLComposeViewController将不在窗口层次结构中的*视为*

当我在游戏中推送Twitter图像时,我想显示共享图像(SLComposeViewController的模式显示)。 但是,当我推动Twitterbutton,显示不显示和日志说像标题。 然后,我search了类似的问题,但我不知道该怎么做… [ViewDidLoad]和[ViewDidAppear]是重要的事情,我知道。 以下是我的代码。 ViewController.m #import "ViewController.h" #import "NewGameScene.h" #import <Social/Social.h> #import "GameOverScene.h" @interface ViewController () { GameOverScene *gameOver; } @end @implementation ViewController //Loads the view onto our main class – (void)loadView { self.view = [[SKView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; } //Executes when view finishes loading – (void)viewWillLayoutSubviews { //extracted important code. [super viewDidLoad]; […]

其视图不在窗口层次结构中 – 电子邮件表单

我在appdelegate中从viewcontroller调用一个方法。 当我testingfunction时,我只是使用NSLog消息,它工作正常(所以viewcontroller和appdelegate之间的连接是好的)。 一旦我将电子邮件表单添加到此方法中,问题就出现了。 我收到的消息是: Warning: Attempt to present <MFMailComposeViewController: 0x1fdc3990> on <ViewController: 0x1fd9e3b0> whose view is not in the window hierarchy! 任何人知道该怎么办? 我知道有很多话题是“谁的观点不在窗口层级”的问题,但他们都没有帮助我。 ViewController.m … -(void)mail{ NSLog(@"blablabla"); if ([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init]; mail.mailComposeDelegate = self; [mail setSubject:@"Hello and welcome!"]; NSArray *toRecipients = [NSArray arrayWithObject:@"tomas.javnicky@gmail.com"]; [mail setToRecipients:toRecipients]; [mail setCcRecipients:toRecipients]; NSString *emailBody […]

谁的观点不在窗口层次结构问题中?

警告:尝试呈现其视图不在窗口层次结构中的视图! 是的,在发布这个问题之前,我已经看过其他问题和答案。 他们没有帮我解决这个问题。 这是我正在做的。 我打电话给我的单身类socialHelper显示一个操作表,其中postToFacebook方法是一个选项select。 当点击这个动作时,我得到了上面的警告,并且不显示postToFacebook 。 我从UIViewController调用这个UINavigationController作为主控制器,而我的SocialHelper类是一个NSOject 。 – (void)postToFacebook { if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { slComposeViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; [slComposeViewController setInitialText:@"Building stairs? Checkout StairsPro on the app store!"]; [slComposeViewController addImage:[UIImage imageNamed:@"StairsIcon120x120.png"]]; [slComposeViewController addURL:[NSURL URLWithString:@"https://itunes.apple.com/us/app/stairs-pro/id477032819?ls=1&mt=8"]]; [self presentViewController:slComposeViewController animated:YES completion:nil]; // I've also tried this, which shows the post window, but after hitting cancel or post, […]