This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
I try to make a PickerView with ActionSheet.The code is ok in X-code, but crash will occur when I run it and press the "Button", please help to check what have I missed?
Thank you.
Here is the .h file
#import <UIKit/UIKit.h>
#interface UIPickerView_ActionSheetViewController : UIViewController <UIActionSheetDelegate, UIPickerViewDelegate>
{
IBOutlet UIButton *button;
}
#property (nonatomic, retain) UIButton *button;
- (IBAction)buttonPressed;
#end
Here is the .m file
#import "UIPickerView_ActionSheetViewController.h"
#implementation UIPickerView_ActionSheetViewController
#synthesize button;
- (IBAction)buttonPressed
{
UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:#"currentData"
delegate:self
cancelButtonTitle:#"Done"
destructiveButtonTitle:#"Cancel"
otherButtonTitles:nil];
UIPickerView *pickerView = [[UIPickerView alloc]initWithFrame:CGRectMake(0,40,480,200)];
pickerView.delegate = self;
pickerView.showsSelectionIndicator = YES;
[menu addSubview:pickerView];
[menu showInView:self.view];
[menu setBounds:CGRectMake(0,0,480, 320)];
[pickerView release];
[menu release];
}
- (void)dealloc
{
[button release];
[super dealloc];
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload
{
self.button=nil;
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#end
Crash on int retVal = UIApplicationMain(argc, argv, nil, nil);
#import <UIKit/UIKit.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
Crash Info
#0 0x9631817a in __kill ()
#1 0x9631816c in kill$UNIX2003 ()
#2 0x963aa879 in raise ()
#3 0x963c09b8 in abort ()
#4 0x9619dfda in __gnu_cxx::__verbose_terminate_handler ()
#5 0x00f1c23b in _objc_terminate ()
#6 0x9619c17a in __cxxabiv1::__terminate ()
#7 0x9619c1ba in std::terminate ()
#8 0x9619c2b8 in __cxa_throw ()
#9 0x00f1c416 in objc_exception_throw ()
#10 0x00dca0bb in -[NSObject(NSObject) doesNotRecognizeSelector:] ()
#11 0x00d39966 in ___forwarding___ ()
#12 0x00d39522 in __forwarding_prep_0___ ()
#13 0x0001a4fd in -[UIApplication sendAction:to:from:forEvent:] ()
#14 0x000aa799 in -[UIControl sendAction:to:forEvent:] ()
#15 0x000acc2b in -[UIControl(Internal) _sendActionsForEvents:withEvent:] ()
#16 0x000ab7d8 in -[UIControl touchesEnded:withEvent:] ()
#17 0x0003eded in -[UIWindow _sendTouchesForEvent:] ()
#18 0x0001fc37 in -[UIApplication sendEvent:] ()
#19 0x00024f2e in _UIApplicationHandleEvent ()
#20 0x01001992 in PurpleEventCallback ()
#21 0x00da9944 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#22 0x00d09cf7 in __CFRunLoopDoSource1 ()
#23 0x00d06f83 in __CFRunLoopRun ()
#24 0x00d06840 in CFRunLoopRunSpecific ()
#25 0x00d06761 in CFRunLoopRunInMode ()
#26 0x010001c4 in GSEventRunModal ()
#27 0x01000289 in GSEventRun ()
#28 0x00028c93 in UIApplicationMain ()
#29 0x00001c09 in main (argc=1, argv=0xbfffef8c) at main.m:14
Maybe this can help more
Attaching to process 606.
2011-12-10 06:37:08.456 UIPickerView_ActionSheet[606:207] -[UIPickerView_ActionSheetViewController DatePickerView]: unrecognized selector sent to instance 0x602dfb0
2011-12-10 06:37:08.458 UIPickerView_ActionSheet[606:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIPickerView_ActionSheetViewController DatePickerView]: unrecognized selector sent to instance 0x602dfb0'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dc85a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f1c313 objc_exception_throw + 44
2 CoreFoundation 0x00dca0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d39966 ___forwarding___ + 966
4 CoreFoundation 0x00d39522 _CF_forwarding_prep_0 + 50
5 UIKit 0x0001a4fd -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x000aa799 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x000acc2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x000ab7d8 -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x0003eded -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x0001fc37 -[UIApplication sendEvent:] + 447
11 UIKit 0x00024f2e _UIApplicationHandleEvent + 7576
12 GraphicsServices 0x01001992 PurpleEventCallback + 1550
13 CoreFoundation 0x00da9944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x00d09cf7 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x00d06f83 __CFRunLoopRun + 979
16 CoreFoundation 0x00d06840 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x00d06761 CFRunLoopRunInMode + 97
18 GraphicsServices 0x010001c4 GSEventRunModal + 217
19 GraphicsServices 0x01000289 GSEventRun + 115
20 UIKit 0x00028c93 UIApplicationMain + 1160
21 UIPickerView_ActionSheet 0x00001cf9 main + 121
22 UIPickerView_ActionSheet 0x00001c75 start + 53
)
terminate called after throwing an instance of 'NSException'
Current language: auto; currently objective-c
[UIPickerView_ActionSheetViewController DatePickerView]: unrecognized selector sent to instance 0x602dfb0
What this tells you is that somewhere you are sending the message DatePickerView to your view controller instance, and it doesn't recognise it.
I can't see such a call anywhere in the code above so it is either in a different file in your project, or you have an old or renamed outlet connection in interface builder. If you have copied this code or some of the resources from somewhere else then you will need to update them to match your actual requirements.
Related
I got crash report from live user
I have NSObject which has nsstring
#interface MountedVolume : NSObject
#property (nonatomic, strong) NSString *name;
#end
View controller has textfield it values gets changed when notification
received .
#interface ViewController : NSViewController {
MountedVolume *selectedVolume;
__weak IBOutlet NSTextField *txtVolumeName;
}
#end
#implementation ViewController
- (void)viewDidLoad {
[[NSNotificationCenter defaultCenter] addObserverForName:DCNotificationNameVolumesUpdated object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
dispatch_async(dispatch_get_main_queue(), ^{
//crash report says in this line it got crashed
txtVolumeName.stringValue = selectedVolume.name;
});
}];
}
#end
Below is the crash report any suggestion how to deal with this?
crash report
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x7fff6ac2639d objc_msgSend + 29
1 AppKit 0x7fff3db3d868 -[NSCell _objectValue:forString:errorDescription:] + 157
2 AppKit 0x7fff3db3d71d -[NSCell setStringValue:] + 40
3 AppKit 0x7fff3db95044 -[NSControl setStringValue:] + 135
4 MyApp 0x104de865b __40-[ViewController viewDidLoad]_block_invoke_3 (ViewController.m:172)
5 libdispatch.dylib 0x7fff6c3ab5f8 _dispatch_call_block_and_release + 12
6 libdispatch.dylib 0x7fff6c3ac63d _dispatch_client_callout + 8
7 libdispatch.dylib 0x7fff6c3b768d _dispatch_main_queue_callback_4CF + 1135
8 CoreFoundation 0x7fff40435f56 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
9 CoreFoundation 0x7fff40435683 __CFRunLoopRun + 2300
10 CoreFoundation 0x7fff40434b35 CFRunLoopRunSpecific + 459
11 HIToolbox 0x7fff3f71396b RunCurrentEventLoopInMode + 292
12 HIToolbox 0x7fff3f7136a5 ReceiveNextEventCommon + 603
13 HIToolbox 0x7fff3f713436 _BlockUntilNextEventMatchingListInModeWithFilter + 64
14 AppKit 0x7fff3daad987 _DPSNextEvent + 965
15 AppKit 0x7fff3daac71f -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1361
16 AppKit 0x7fff3daa683c -[NSApplication run] + 699
17 AppKit 0x7fff3da95d7c NSApplicationMain + 777
18 libdyld.dylib 0x7fff6c3f93d5 start + 1
Looking at the docs, stringValue does not appear to be optional. You do not initialize selectedVolume before viewDidLoad (as far as I can tell) and that means you are likely trying to set this value to nil inside this notification block if it runs before selectedVolume is assigned a value. I would start by trying to set txtVolumeName.stringValue to a hard-coded value first and see if it stops crashing altogether. If it does, you may need to guard against nil values before you call the setter.
e.g.
NSString *string;
NSTextField *textField = [[NSTextField alloc]init];
if (string) {
textField.stringValue = string;
}
User can tap the next UITextField to enter data or can touch next button on Keyboard.
I have used textFieldShouldReturn method to add text object to array. It works well until I touch next UITextfield to enter data instead of touching next on keyboard and then since no data is added to my array, later in segue, UITableViewController crashes.
Do I need to implement both method or am something wrong here.
ModalViewController.m
#interface ModalViewController (){
NSMutableArray *arrayToReturn;
}
#property (strong, nonatomic) IBOutlet UITextField *bookTextField;
#property (strong, nonatomic) IBOutlet UITextField *pageTextField;
#property (strong, nonatomic) IBOutlet customAddBookButton *doneButton;
#end
#implementation ModalViewController
#pragma mark- textField Delegate
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
NSLog(#"textFieldShouldReturn");
if (textField == self.bookTextField) {
[self.pageTextField becomeFirstResponder];
}else if (textField == self.pageTextField){
if ([self.bookTextField.text isEqual:#""]) {
[self.bookTextField becomeFirstResponder];
}else {
[self.pageTextField resignFirstResponder];
}
}
[arrayToReturn insertObject:self.bookTextField.text atIndex:0];
[arrayToReturn insertObject:self.pageTextField.text atIndex:1];
return YES;
}
#pragma mark- Done button action
- (IBAction)Done:(id)sender {
self.bookMetaReturnedfromModalView (arrayToReturn);
NSLog(#"array is %#", arrayToReturn);
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark- viewDidLoad
- (void)viewDidLoad {
[super viewDidLoad];
[self.bookTextField becomeFirstResponder];
arrayToReturn = [[NSMutableArray alloc]init];
}
#end
crash log
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds for empty array'
*** First throw call stack:
(
0 CoreFoundation 0x000000011089df65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000110315deb objc_exception_throw + 48
2 CoreFoundation 0x0000000110781a94 -[__NSArrayM objectAtIndex:] + 212
3 BookApp 0x000000010fe0722d -[AddBooksTableViewController tableView:cellForRowAtIndexPath:] + 413
4 UIKit 0x0000000110fc06b3 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 782
5 UIKit 0x0000000110fc07c8 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
6 UIKit 0x0000000110f96650 -[UITableView _updateVisibleCellsNow:isRecursive:] + 3187
7 UIKit 0x0000000110fc9595 -[UITableView _performWithCachedTraitCollection:] + 92
8 UIKit 0x0000000110fb19ad -[UITableView layoutSubviews] + 218
9 UIKit 0x0000000110f2211c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 710
10 QuartzCore 0x000000011547736a -[CALayer layoutSublayers] + 146
11 QuartzCore 0x000000011546bbd0 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
12 QuartzCore 0x000000011546ba4e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
13 QuartzCore 0x00000001154601d5 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
14 QuartzCore 0x000000011548d9f0 _ZN2CA11Transaction6commitEv + 508
15 QuartzCore 0x000000011548e154 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
16 CoreFoundation 0x00000001107c99d7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
17 CoreFoundation 0x00000001107c9947 __CFRunLoopDoObservers + 391
18 CoreFoundation 0x00000001107bf59b __CFRunLoopRun + 1147
19 CoreFoundation 0x00000001107bee98 CFRunLoopRunSpecific + 488
20 GraphicsServices 0x0000000114f2aad2 GSEventRunModal + 161
21 UIKit 0x0000000110e71676 UIApplicationMain + 171
22 BookApp 0x000000010fe082cf main + 111
23 libdyld.dylib 0x000000011316792d start + 1
24 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
After adding objects to array in textField shouldChangeCharactersInRange method array is being populated simultaneously and everything is working fine.
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if (textField == self.bookTextField) {
[arrayToReturn insertObject:[[self.bookTextField text] stringByReplacingCharactersInRange:range withString:string] atIndex:0];
}else if (textField == self.pageTextField){
[arrayToReturn insertObject:[[self.pageTextField text] stringByReplacingCharactersInRange:range withString:string] atIndex:1];
}
return YES;
}
I need to get the text from URL http://cast.midiaip.com.br:6530/currentsong?sid=1 and display it in a UILabel
My code is like that:
ViewController.h
#import <UIKit/UIKit.h>
#interface ViewController : UIViewController
#property (strong, nonatomic) IBOutlet UILabel *musicasLabel;
- (IBAction)textoButton:(id)sender;
#property (strong, nonatomic) IBOutlet UIWebView *webView;
#end
ViewController.m
#import "ViewController.h"
#interface ViewController ()
#end
#implementation ViewController
#synthesize musicasLabel;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)textoButton:(id)sender {
NSURL *url = [NSURL URLWithString:#"http://cast.midiaip.com.br:6530/currentsong?sid=1"];
NSData *data = [NSData dataWithContentsOfURL:url];
NSString *string = [NSString stringWithUTF8String:[data bytes]];
musicasLabel.text = string;
}
#end
I always get the error:
2015-04-17 02:55:21.637 teste label[14194:797672] ***
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '***
+[NSString stringWithUTF8String:]: NULL cString'
*** First throw call stack:
(
0 CoreFoundation 0x000000010cf1bf35
__exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010cbb4bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010cf1be6d +[NSException raise:format:] + 205
3 Foundation 0x000000010c719464 +[NSString stringWithUTF8String:] + 78
4 teste label 0x000000010c6885e5 -[ViewController textoButton:] + 181
5 UIKit 0x000000010d3098be -[UIApplication sendAction:to:from:forEvent:] + 75
6 UIKit 0x000000010d410410 -[UIControl _sendActionsForEvents:withEvent:] + 467
7 UIKit 0x000000010d40f7df -[UIControl touchesEnded:withEvent:] + 522
8 UIKit 0x000000010d34f308 -[UIWindow _sendTouchesForEvent:] + 735
9 UIKit 0x000000010d34fc33 -[UIWindow sendEvent:] + 683
10 UIKit 0x000000010d31c9b1 -[UIApplication sendEvent:] + 246
11 UIKit 0x000000010d329a7d _UIApplicationHandleEventFromQueueEvent + 17370
12 UIKit 0x000000010d305103 _UIApplicationHandleEventQueue + 1961
13 CoreFoundation 0x000000010ce51551 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x000000010ce4741d __CFRunLoopDoSources0 + 269
15 CoreFoundation 0x000000010ce46a54 __CFRunLoopRun + 868
16 CoreFoundation 0x000000010ce46486 CFRunLoopRunSpecific + 470
17 GraphicsServices 0x00000001104ea9f0 GSEventRunModal + 161
18 UIKit 0x000000010d308420 UIApplicationMain + 1282
19 teste label 0x000000010c688ae3 main + 115
20 libdyld.dylib 0x000000010f4ab145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Thank you very much!!!
You are initializing your string incorrectly. Your question is answered here:
convert UTF-8 encoded NSData to a NSString
I get the following error when saving managedObjectContext:
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[Image count]: unrecognized selector sent to instance
Code:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)selectedImage editingInfo:(NSDictionary *)editingInfo {
// Delete any existing image.
Image *oldImage = _place.image;
if (oldImage != nil) {
[_place.managedObjectContext deleteObject:oldImage];
}
Image *image = [NSEntityDescription insertNewObjectForEntityForName:#"Image" inManagedObjectContext:_place.managedObjectContext];
image.imageData = UIImageJPEGRepresentation(selectedImage, 0.5);
_place.image = image;
[_place.managedObjectContext save:nil]; //Here is the crash
[self dismissViewControllerAnimated:YES completion:nil];
Image entity has two one-to-one relationships: place and trip.
#interface Image : NSManagedObject
#property (nonatomic, retain) NSData * imageData;
#property (nonatomic, retain) Trip *trip;
#property (nonatomic, retain) Place *place;
#end
Can't understand why [Image count] error comes out on one-to-one relationship.
Upd.:
#interface Place : NSManagedObject
#property (nonatomic, retain) NSString * address;
#property (nonatomic, retain) NSString * name;
#property (nonatomic, retain) id thumbnail;
#property (nonatomic, retain) Image *image;
#end
Upd.2:
*** First throw call stack:
(
0 CoreFoundation 0x022935e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01cef8b6 objc_exception_throw + 44
2 CoreFoundation 0x02330903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0228390b ___forwarding___ + 1019
4 CoreFoundation 0x022834ee _CF_forwarding_prep_0 + 14
5 CoreData 0x00803df8 -[NSSQLCore _knownOrderKeyForObject:from:inverseToMany:] + 200
6 CoreData 0x0073ad50 -[NSSQLCore _populateRowForOp:withObject:] + 1120
7 CoreData 0x00750e27 -[NSSQLCore recordValuesForInsertedObject:] + 71
8 CoreData 0x00739b5d -[NSSQLCore recordChangesInContext:] + 685
9 CoreData 0x00738925 -[NSSQLCore saveChanges:] + 565
10 CoreData 0x0070555c -[NSSQLCore executeRequest:withContext:error:] + 412
11 CoreData 0x00705050 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 4704
12 CoreData 0x00731ccc -[NSManagedObjectContext save:] + 764
13 Travel Plan 0x0001cf12 -[PlaceViewController imagePickerController:didFinishPickingImage:editingInfo:] + 738
14 UIKit 0x00cd5e6c -[UIImagePickerController _imagePickerDidCompleteWithInfo:] + 488
15 PhotoLibrary 0x13694e94 PLNotifyImagePickerOfImageAvailability + 106
16 PhotosUI 0x14411585 -[PUUIPhotosAlbumViewController handleNavigateToAsset:inContainer:] + 401
17 PhotosUI 0x143947b4 -[PUPhotosGridViewController collectionView:shouldSelectItemAtIndexPath:] + 577
18 UIKit 0x0106dc0b -[UICollectionView _selectItemAtIndexPath:animated:scrollPosition:notifyDelegate:] + 173
19 UIKit 0x010861f8 -[UICollectionView _userSelectItemAtIndexPath:] + 189
20 UIKit 0x010863b5 -[UICollectionView touchesEnded:withEvent:] + 437
21 libobjc.A.dylib 0x01d01874 -[NSObject performSelector:withObject:withObject:] + 77
22 UIKit 0x00bb6902 forwardTouchMethod + 271
23 UIKit 0x00bb6972 -[UIResponder touchesEnded:withEvent:] + 30
24 libobjc.A.dylib 0x01d01874 -[NSObject performSelector:withObject:withObject:] + 77
25 UIKit 0x00bb6902 forwardTouchMethod + 271
26 UIKit 0x00bb6972 -[UIResponder touchesEnded:withEvent:] + 30
27 libobjc.A.dylib 0x01d01874 -[NSObject performSelector:withObject:withObject:] + 77
28 UIKit 0x00bb6902 forwardTouchMethod + 271
29 UIKit 0x00bb6972 -[UIResponder touchesEnded:withEvent:] + 30
30 UIKit 0x00dd1c7f _UIGestureRecognizerUpdate + 7166
31 UIKit 0x00a9c19a -[UIWindow _sendGesturesForEvent:] + 1291
32 UIKit 0x00a9d0ba -[UIWindow sendEvent:] + 1030
33 UIKit 0x00a70e86 -[UIApplication sendEvent:] + 242
34 UIKit 0x00a5b18f _UIApplicationHandleEventQueue + 11421
35 CoreFoundation 0x0221c83f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
36 CoreFoundation 0x0221c1cb __CFRunLoopDoSources0 + 235
37 CoreFoundation 0x0223929e __CFRunLoopRun + 910
38 CoreFoundation 0x02238ac3 CFRunLoopRunSpecific + 467
39 CoreFoundation 0x022388db CFRunLoopRunInMode + 123
40 GraphicsServices 0x046299e2 GSEventRunModal + 192
41 GraphicsServices 0x04629809 GSEventRun + 104
42 UIKit 0x00a5dd3b UIApplicationMain + 1225
43 Travel Plan 0x0004c53d main + 141
44 libdyld.dylib 0x02dd170d start + 1
)
I got exactly the same problem after changing some relations in my models. This seems to be a bug in Xcode that appears when you change a relationship that was "to many : ordered" to a "to one" relation. It's like Xcode still thinks that the relation is to many because the "ordered" tick-box is ticked.
A very easy solution to solve this is to change back to a "to many" relationship, unselect "ordered" and then change it back again to a "to one" relation.
That was some bug in Xcode. After setting relationship to many, and then back to one, it started to work without errors.
I'm trying to create an NSMutableArray of ModuleViewControllers (which inherits from UIViewController) in order to open a given view from a given button. The ModuleViewController is also described in ModuleViewController.xib
So I load a list of module xml files and pass them, one by one, to a constructor (which ignores them atm) and then add the result to an NSMutableArray.
The problem happens when I try to push the view controller. I get a SIGABRT/exception and I'm not sure why. Any ideas?
Failed Call:
-(IBAction) buttonPressed:(id)sender {
ModuleViewController *module = [moduleVCList objectAtIndex:[sender tag]];
[[self navigationController] pushViewController:module animated:YES];
}
Constructor Call:
[moduleVCList addObject:
[[ModuleViewController alloc] initWithXMLName:[module objectForKey:#"file"]]];
Constructor:
- (id)initWithXMLName:(NSString *)xmlName {
self = [super initWithNibName:#"ModuleViewController" bundle:nil];
if (self) {
}
return self;
}
Backtrace:
#0 0x01867cf0 in objc_exception_throw ()
#1 0x0167ea78 in +[NSException raise:format:arguments:] ()
#2 0x0167e9e9 in +[NSException raise:format:] ()
#3 0x00209f0d in -[UIViewController _loadViewFromNibNamed:bundle:] ()
#4 0x0020a3a9 in -[UIViewController loadView] ()
#5 0x0020a5cb in -[UIViewController view] ()
#6 0x0020a941 in -[UIViewController contentScrollView] ()
#7 0x0021c47d in -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] ()
#8 0x0021c66f in -[UINavigationController _layoutViewController:] ()
#9 0x0021c93b in -[UINavigationController _startTransition:fromViewController:toViewController:] ()
#10 0x0021d3df in -[UINavigationController _startDeferredTransitionIfNeeded] ()
#11 0x0021d986 in -[UINavigationController pushViewController:transition:forceImmediate:] ()
#12 0x0021d5a4 in -[UINavigationController pushViewController:animated:] ()
#13 0x00003c1a in -[MainViewController buttonPressed:] (self=0x6a283d0, _cmd=0xb874, sender=0x6a286c0) at *snip*/MainViewController.m:149
#14 0x016d7ec9 in -[NSObject performSelector:withObject:withObject:] ()
#15 0x001475c2 in -[UIApplication sendAction:to:from:forEvent:] ()
#16 0x0014755a in -[UIApplication sendAction:toTarget:fromSender:forEvent:] ()
#17 0x001ecb76 in -[UIControl sendAction:to:forEvent:] ()
#18 0x001ed03f in -[UIControl(Internal) _sendActionsForEvents:withEvent:] ()
#19 0x001ec2fe in -[UIControl touchesEnded:withEvent:] ()
#20 0x0016ca30 in -[UIWindow _sendTouchesForEvent:] ()
#21 0x0016cc56 in -[UIWindow sendEvent:] ()
#22 0x00153384 in -[UIApplication sendEvent:] ()
#23 0x00146aa9 in _UIApplicationHandleEvent ()
#24 0x015c0fa9 in PurpleEventCallback ()
#25 0x016aa1c5 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#26 0x0160f022 in __CFRunLoopDoSource1 ()
#27 0x0160d90a in __CFRunLoopRun ()
#28 0x0160cdb4 in CFRunLoopRunSpecific ()
#29 0x0160cccb in CFRunLoopRunInMode ()
#30 0x015bf879 in GSEventRunModal ()
#31 0x015bf93e in GSEventRun ()
#32 0x00144a9b in UIApplicationMain ()
#33 0x00002862 in main (argc=1, argv=0xbfffedc8) at *snip*/main.m:16
#34 0x000027d5 in start ()