Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone main.m—中的iOS错误“;已接收程序”;SIGABRT“;_Iphone_Xcode_Sigabrt - Fatal编程技术网

Iphone main.m—中的iOS错误“;已接收程序”;SIGABRT“;

Iphone main.m—中的iOS错误“;已接收程序”;SIGABRT“;,iphone,xcode,sigabrt,Iphone,Xcode,Sigabrt,我不熟悉xcode 4.5 我正在开发一个应用程序,它在运行时出现错误时停止 这是main.m文件中发生错误的代码 // *********************************************************** // main.m // ex21 // #import <UIKit/UIKit.h> #import "ex21AppDelegate.h" int main(int argc, char *argv[]) { @autor

我不熟悉xcode 4.5

我正在开发一个应用程序,它在运行时出现错误时停止

这是main.m文件中发生错误的代码

// ***********************************************************
//  main.m
//  ex21
//

#import <UIKit/UIKit.h>

#import "ex21AppDelegate.h"

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

        //Login *login1 = [[Login alloc]init];
        //[login1 setLoginid:@"Sam"];
        //[login1 setPassword:ca@"test1"];
        //NSLog(@"Login ID = %@, Password = %@",[login1 loginid], [login1 password]);

        return UIApplicationMain(argc, argv, nil, NSStringFromClass([ex21AppDelegate class]));

    }
}


// ***********************************************************
//  ex21AppDelegate.h
//  ex21
//

#import <UIKit/UIKit.h>

@interface ex21AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end


// ***********************************************************
//  ex21AppDelegate.m
//  ex21
//

#import "ex21AppDelegate.h"

@implementation ex21AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end


// ***********************************************************
//  ex21MainMenu.h
//  ex21
//

#import <UIKit/UIKit.h>

@interface ex21MainMenu : UIView {

}

-(IBAction)hyperlink;

@end


// ***********************************************************
//
//  ex21MainMenu.m
//  ex21
//

#import "ex21MainMenu.h"

@implementation ex21MainMenu

- (IBAction)hyperlink {
    [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"http://www.google.com"]];

}

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end



// ***********************************************************
//  ex21ViewController.h
//  ex21
//

#import <UIKit/UIKit.h>

@interface ex21ViewController:  UITableViewController

@end


// ***********************************************************
//  ex21ViewController.m
//  ex21
//

#import "ex21ViewController.h"

@interface ex21ViewController ()

@end

@implementation ex21ViewController

- (IBAction)doneWithKeyboard:(id)sender {
    [sender resignFirstResponder];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

@end
//***********************************************************
//main.m
//ex21
//
#进口
#导入“ex21AppDelegate.h”
int main(int argc,char*argv[])
{
@自动释放池{
返回UIApplicationMain(argc、argv、nil、NSStringFromClass([ex21AppDelegate类]);
//Login*login1=[[Login alloc]init];
//[login1 setLoginid:@“Sam”];
//[login1 setPassword:ca@“test1”];
//NSLog(@“登录ID=%@,密码=%@,[login1 loginid],[login1 Password]);
返回UIApplicationMain(argc、argv、nil、NSStringFromClass([ex21AppDelegate类]);
}
}
// ***********************************************************
//ex21AppDelegate.h
//ex21
//
#进口
@接口ex21AppDelegate:UIResponder
@属性(强,非原子)UIWindow*window;
@结束
// ***********************************************************
//ex21AppDelegate.m
//ex21
//
#导入“ex21AppDelegate.h”
@实现ex21AppDelegate
-(BOOL)应用程序:(UIApplication*)应用程序使用选项完成启动:(NSDictionary*)启动选项
{
//应用程序启动后自定义的覆盖点。
返回YES;
}
-(无效)应用程序将重新签名:(UIApplication*)应用程序
{
//当应用程序即将从活动状态移动到非活动状态时发送。这可能发生在某些类型的临时中断(如来电或短信)或用户退出应用程序并开始转换到后台状态时。
//使用此方法暂停正在进行的任务、禁用计时器和降低OpenGL ES帧速率。游戏应使用此方法暂停游戏。
}
-(无效)应用程序标识符背景:(UIApplication*)应用程序
{
//使用此方法释放共享资源、保存用户数据、使计时器无效,并存储足够的应用程序状态信息,以便在应用程序稍后终止时将其恢复到当前状态。
//如果您的应用程序支持后台执行,则会调用此方法而不是applicationWillTerminate:当用户退出时。
}
-(无效)应用程序将进入前台:(UIApplication*)应用程序
{
//作为从后台转换到非活动状态的一部分调用;在这里,您可以撤消进入后台时所做的许多更改。
}
-(无效)应用IDBECOMEACTIVE:(UIApplication*)应用
{
//重新启动应用程序处于非活动状态时暂停(或尚未启动)的所有任务。如果应用程序以前位于后台,可以选择刷新用户界面。
}
-(无效)申请将终止:(UIApplication*)申请
{
//当应用程序即将终止时调用。如果合适,请保存数据。另请参阅ApplicationIdentinterBackground:。
}
@结束
// ***********************************************************
//ex21main菜单.h
//ex21
//
#进口
@界面EX21Main菜单:UIView{
}
-(i)超链接;
@结束
// ***********************************************************
//
//ex21MainMenu.m
//ex21
//
#导入“ex21MainMenu.h”
@实现EX21main菜单
-(IBAction)超链接{
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:@”http://www.google.com"]];
}
-(id)initWithFrame:(CGRect)帧
{
self=[super initWithFrame:frame];
如果(自我){
//初始化代码
}
回归自我;
}
/*
//仅覆盖drawRect:如果执行自定义绘图。
//空实现会对动画期间的性能产生不利影响。
-(void)drawRect:(CGRect)rect
{
//绘图代码
}
*/
@结束
// ***********************************************************
//ex21ViewController.h
//ex21
//
#进口
@接口ex21ViewController:UITableViewController
@结束
// ***********************************************************
//ex21ViewController.m
//ex21
//
#导入“ex21ViewController.h”
@接口ex21ViewController()
@结束
@ex21ViewController的实现
-(iAction)doneWithKeyboard:(id)发送方{
[发送方辞职第一响应方];
}
-(布尔)应自动旋转指针面定向:(UIInterfaceOrientation)interfaceOrientation
{
返回(interfaceOrientation!=UIInterfaceOrientation肖像向上向下);
}
@结束
我阻止上面的代码导入下面的代码,因为我决定不使用它。

// ***********************************************************
//  Login.h
//  ex21
//

#import <Foundation/Foundation.h>

@interface Login : NSObject

@property (nonatomic, strong) NSString *loginid;
@property (nonatomic, strong) NSString *password;

- (id)initWithLoginID:(NSString *)loginid
             password:(NSString *)password;
@end

// ***********************************************************
//  Login.m
//  ex21
//

#import "Login.h"

@implementation Login

@synthesize loginid = _loginid;
@synthesize password = _password;

- (id)initWithLoginID:(NSString *)loginid
             password:(NSString *)password
{
    self = [super init];
    if (self != nil){
        _loginid = loginid;
        _password = password;
    }
    return self;
}
@end
//***********************************************************
//Login.h
//ex21
//
#进口
@接口登录名:NSObject
@属性(非原子,强)NSString*loginid;
@属性(非原子,强)NSString*密码;
-(id)initWithLoginID:(NSString*)loginid
密码:(NSString*)密码;
@结束
// ***********************************************************
//登录名
//ex21
//
#导入“Login.h”
@实现登录
@综合loginid=_loginid;
@综合密码=_密码;
-(id)initWithLoginID:(NSString*)loginid
密码:(NSString*)密码
{
self=[super init];
if(self!=nil){
_loginid=loginid;
_密码=密码;
}
回归自我;
}
@结束
=======================================

异常状态寄存器指示以下内容:

  • rapno(无符号整数)
  • 错误(无符号整数)
  • faultvaddr(无符号整数)

有人知道发生了什么吗?

在SIGABRT错误中,它总是显示主要错误,但这不是问题的根源。你能追踪一下你的项目在哪里发生的吗。它通常类似于引用未初始化的变量。调试器控制台中应该有更多信息。我删除了初始化变量的代码,因为我不再计划使用它们。如果我注释掉上面的代码