• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ios - 按下按钮时应用程序崩溃; iOS模拟

[复制链接]
菜鸟教程小白 发表于 2022-12-12 19:45:56 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我正在构建/学习我的第一个 Xcode 应用程序。我以前用过 C,现在正在尝试学习 Objective C 来构建 iPhone 应用程序。

我构建了一个简单的应用程序,当我运行 iOS 模拟器并按下一个指向 Storyboard中另一个屏幕的按钮时,应用程序崩溃了。到目前为止,我已经使用 Storyboard构建了整个应用程序。

这是我的整个 main.m 文件...

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char * argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

这是错误...

2014-03-02 21:22:04.422 Meal Plan Generator[4777:70b] * Terminating app due to uncaught exception 'NSGenericException', reason: 'ush segues can only be used when the source controller is managed by an instance of UINavigationController.' * First throw call stack: ( 0 CoreFoundation 0x00000001018a2795 exceptionPreprocess + 165 1 libobjc.A.dylib
0x00000001015ee991 objc_exception_throw + 43 2 UIKit
0x00000001006ef051 -[UIStoryboardPushSegue destinationContainmentContext] + 0 3 UIKit
0x0000000100252096 -[UIApplication sendAction:to:from:forEvent:] + 80 4 UIKit 0x0000000100252044 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 17 5 UIKit 0x0000000100326450 -[UIControl _sendActionsForEvents:withEvent:] + 203 6 UIKit 0x00000001003259c0 -[UIControl touchesEnded:withEvent:] + 530 7
UIKit 0x0000000100286c15 -[UIWindow _sendTouchesForEvent:] + 701 8 UIKit 0x0000000100287633 -[UIWindow sendEvent:] + 988 9 UIKit
0x0000000100260fa2 -[UIApplication sendEvent:] + 211 10 UIKit
0x000000010024ed7f _UIApplicationHandleEventQueue + 9549 11 CoreFoundation 0x0000000101831ec1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
+ 17 12 CoreFoundation 0x0000000101831792 __CFRunLoopDoSources0 + 242 13 CoreFoundation 0x000000010184d61f __CFRunLoopRun + 767 14 CoreFoundation
0x000000010184cf33 CFRunLoopRunSpecific + 467 15 GraphicsServices
0x00000001039923a0 GSEventRunModal + 161 16 UIKit
0x0000000100251043 UIApplicationMain + 1010 17 Meal Plan Generator
0x0000000100001193 main + 115 18 libdyld.dylib
0x0000000101f1a5fd start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)



Best Answer-推荐答案


错误表明您正在尝试使用推送选项,但您的 View Controller 没有导航 Controller 。在您的 Storyboard中单击您尝试推送的第一个 View ,然后从编辑器部分的顶部菜单中选择嵌入,然后选择导航 Controller 。该错误将消失。确保您的标识符也在 Storyboard中为 segue 设置。或者选择segue并将其更改为modal,然后尝试,应用程序将编译。

关于ios - 按下按钮时应用程序崩溃; iOS模拟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22137504/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap