gpt4 book ai didi

iphone - 此代码适用于 iOS4.3,不适用于 iOS5

转载 作者:行者123 更新时间:2023-12-03 19:44:38 25 4
gpt4 key购买 nike

以下代码在 iOS4.3 iPhone 和 iPad 以及 iOS5 iPhone 上按预期工作,但在 iOS5 iPad 上崩溃。当应用程序的先前运行被取消时,这是我在基于选项卡的应用程序中调用的第一个 View 所调用的。用户可以继续之前的运行或重置。我尝试将此代码移至 -viewWillAppear 和 -viewDidAppear 割线,但无济于事。还有其他人经历过吗? (顺便说一句,我已经确认了 XIB 中的所有连接,以确保此 UniversalApp 的 iPad 部分没有问题。

- (void)viewDidLoad {

BOOL continueYesNo;

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];

continueYesNo = [prefs boolForKey:@"keyContinueMeeting"];

if (continueYesNo) {

NSString *message_continue = [[NSString alloc] initWithFormat:@"Do you want to Continue the Prior event"];

UIActionSheet *actionSheet = [[UIActionSheet alloc]

initWithTitle:message_continue

delegate:self

cancelButtonTitle:@"Reset"

destructiveButtonTitle:@"Continue Meeting"

otherButtonTitles:nil];

[actionSheet showFromTabBar:self.tabBarController.tabBar]; // This is the line that crashes. The program checks for a terminated APP and status in preferences

}

else {

resetStuff.hidden = YES;

}

}

这是崩溃的文本 -

Current language:  auto; currently objective-c

2011-10-12 21:02:55.530 浪费时间[3884:17603] * -[UIActionSheet showInView:]、/SourceCache/UIKit_Sim/UIKit-1912.3/UIActionSheet.m:4630 中断言失败2011-10-12 21:02:55.532 应用程序名称[3884:17603] 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“无效参数不满足: View ” !=零'** 首先抛出调用堆栈:(0x1d87052 0x1f18d0a 0x1d2fa78 0x2742db 0x90b47e 0x90b122 0x90b356 0x90b653 0x6fe1 0x60064e 0x61bb89 0x61b9bd 0x619f8a 0x619e2 f 0x617ffb 0x61885a 0x601fbf 0x60221b 0x6030f1 0x571fec 0x577572 0x57172b 0x2b86 0x5389d6 0x5398a6 0x548743 0x5491f8 0x53caa9 0x2315fa9 0x1d5b1c5 0x1cc0022 0x1cbe90a 0x1cbddb4 0x1cbdccb 0x5392a7 0x53aa9b 0x2abd 0x2325)终止调用抛出异常(gdb

Blockquote

这是代表.h

#import <UIKit/UIKit.h>    
@interface W_AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
UITabBarController *rootController;
float floatVal;
NSDate *currentTime;
NSDate *previousTime;
NSDate *currentQTime;
NSDate *previousQTime;
BOOL continueMeeting;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *rootController;
@property (nonatomic, readwrite) float floatVal;
@property (nonatomic, readwrite) BOOL continueMeeting;
@property (nonatomic, retain) NSDate *currentTime;
@property (nonatomic, retain) NSDate *previousTime;
@property (nonatomic, retain) NSDate *currentQTime;
@property (nonatomic, retain) NSDate *previousQTime;
@end

还有.m

#import "W.h"


@implementation W_AppDelegate

@synthesize window;
@synthesize rootController;
@synthesize floatVal;
@synthesize currentTime;
@synthesize previousTime;
@synthesize currentQTime;
@synthesize previousQTime;
@synthesize continueMeeting;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[window addSubview:rootController.view];
[window makeKeyAndVisible];
return YES;
}

@end

最佳答案

尝试调用你的[super viewDidLoad];第一的。您的 View 可能尚未设置得足以推送 actionSheet。

关于iphone - 此代码适用于 iOS4.3,不适用于 iOS5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7748281/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com