Tôi đang cố chuyển đổi ứng dụng duy nhất của iPhone thành ứng dụng Universal. Tôi chuyển các thiết bị sang Universal và để Xcode làm điều đó tạo ra một MainWindow-iPad.xib cho tôi, và bây giờ khi tôi chạy ứng dụng trong trình mô phỏng iPhone nó hoạt động tốt, nhưng khi tôi chạy nó trong bộ giả lập iPad, tôi nhận được một màu trắng màn hình và lỗi Application windows are expected to have a root view controller at the end of application launch
. Tôi đã đọc một số bài viết khác về vấn đề tương tự nhưng không ai trong số họ chỉ giới hạn trong một thiết bị."Cửa sổ ứng dụng dự kiến sẽ có bộ điều khiển chế độ xem gốc khi kết thúc khởi chạy ứng dụng" chỉ trên iPad
Đây là phương pháp application:didFinishLaunchWithOptions:
tôi:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
/* some dropbox setup stuff */
// INIT VIEW AND CORE DATA
RootViewController *rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
NSManagedObjectContext *context = [self managedObjectContext];
if (!context) {
// Handle the error.
}
rootViewController.managedObjectContext = context;
UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
self.navigationController = aNavigationController;
[_window addSubview:[_navigationController view]];
[_window makeKeyAndVisible];
[rootViewController release];
[aNavigationController release];
return YES;
}
EDIT: Tôi chỉ có cái nhìn khiển một gốc mà có kích thước dành cho iPhone gọi RootViewController. Nhưng nó vẫn nên tải trong phải không? Hoặc nếu nó không nên làm thế nào để tôi tạo một cho iPad?
Dãy: http://stackoverflow.com/q/7520971/9530 http://stackoverflow.com/q/7890511/9530 http://stackoverflow.com/q/8190567/9530 http: // stackoverflow. com/q/11515818/9530 http://stackoverflow.com/q/9844626/9530 và có thể thêm –