My real code is full of NSLog's,
the following line is the reason for he crash but I don't understand why
NSString *newDir = [documentsDirectory
stringByAppendingPathComponent:file];
Here is the whole method:
- (void)viewDidLoad {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray* newArray= [[NSArray alloc]init];
newArray= [fileManager contentsOfDirectoryAtURL:[NSURL fileURLWithPath:#"/Users/admin/Library/FotoAppFotos/"]
includingPropertiesForKeys:[NSArray arrayWithObject:NSURLNameKey] options:NSDirectoryEnumerationSkipsHiddenFiles error:nil];
categories= [NSMutableArray arrayWithArray: newArray];
for(NSString *file in categories) {
NSString *newDir = [documentsDirectory stringByAppendingPathComponent:file]; // in this line the app crashes
[categories addObject:newDir]; //categories
}
[super viewDidLoad];
}
As mentioned the NSLog print of documentsDirectory and file are:
documentsDirectory: /Users/admin/Library/Application Support/iPhone
Simulator/4.3/Applications/D5AB6F90-0420-4A66-B141-D27AB2C11C3C/Documents
file://localhost/Users/admin/Library/FotoAppFotos/Audio/
The whole crash log is:
2011-11-09 09:21:42.989 TestTest[543:207] -[NSURL length]: unrecognized selector sent to instance 0x5c07df0
2011-11-09 09:21:42.992 TestTest[543:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSURL length]: unrecognized selector sent to instance 0x5c07df0'
*** Call stack at first throw:
(
0 CoreFoundation 0x0102b5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0117f313 objc_exception_throw + 44
2 CoreFoundation 0x0102d0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00f9c966 ___forwarding___ + 966
4 CoreFoundation 0x00f9c522 _CF_forwarding_prep_0 + 50
5 Foundation 0x0002b1ad -[NSPathStore2 stringByAppendingPathComponent:] + 211
6 TestTest 0x00003244 -[Produktpalette viewDidLoad] + 535
7 UIKit 0x0036f089 -[UIViewController view] + 179
8 UIKit 0x0060ca40 -[UIPopoverController _setupIncomingViewController:presenting:animated:] + 143
9 UIKit 0x0060be26 -[UIPopoverController initWithContentViewController:] + 321
10 TestTest 0x00002540 -[TestTestViewController produktpalette:] + 151
11 UIKit 0x002bf4fd -[UIApplication sendAction:to:from:forEvent:] + 119
12 UIKit 0x004d1cc3 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 156
13 UIKit 0x002bf4fd -[UIApplication sendAction:to:from:forEvent:] + 119
14 UIKit 0x0034f799 -[UIControl sendAction:to:forEvent:] + 67
15 UIKit 0x00351c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
16 UIKit 0x003507d8 -[UIControl touchesEnded:withEvent:] + 458
17 UIKit 0x002e3ded -[UIWindow _sendTouchesForEvent:] + 567
18 UIKit 0x002c4c37 -[UIApplication sendEvent:] + 447
19 UIKit 0x002c9f2e _UIApplicationHandleEvent + 7576
20 GraphicsServices 0x01983992 PurpleEventCallback + 1550
21 CoreFoundation 0x0100c944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
22 CoreFoundation 0x00f6ccf7 __CFRunLoopDoSource1 + 215
23 CoreFoundation 0x00f69f83 __CFRunLoopRun + 979
24 CoreFoundation 0x00f69840 CFRunLoopRunSpecific + 208
25 CoreFoundation 0x00f69761 CFRunLoopRunInMode + 97
26 GraphicsServices 0x019821c4 GSEventRunModal + 217
27 GraphicsServices 0x01982289 GSEventRun + 115
28 UIKit 0x002cdc93 UIApplicationMain + 1160
29 TestTest 0x00001c2a main + 84
30 TestTest 0x00001bcd start + 53
)
terminate called after throwing an instance of 'NSException'
Thank you for any help and presumption in advance
The hint comes from:
[NSURL length]: unrecognized selector sent to instance
If you are working on iOS, sorry to tell that :
This method is unimplemented in iOS, so it performs no operation.
Somebody has similar problem .
Related
I am calling this code on a background thread.
backgroundContext.performAndWait {
let fetchRequest:NSFetchRequest<BlogPost> = BlogPost.fetchRequest()
fetchRequest.predicate = NSPredicate.init(format: "postid=%#", argumentArray: [someInt64Value]) // this line creates an exception
_ = try? fetchRequest.execute()
....
}
If I remove the predicate, it works fine. The same predicate works just fine if used inside a fetchResultController. postid is Int64 but if I changed the predicate to any other key it would give the same NSInvalidArgumentException
This is very similar to Core Data Error - NSDate localizedCaseInsensitiveCompare: unrecognised selector sent to instance
2016-10-11 21:58:13.918 BlogClient[44494:13192129] -[_SwiftValue longLongValue]: unrecognized selector sent to instance 0x618000243cc0
2016-10-11 21:58:13.922 BlogClient[44494:13192129] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_SwiftValue longLongValue]: unrecognized selector sent to instance 0x618000243cc0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010f59534b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010ebd921e objc_exception_throw + 48
2 CoreFoundation 0x000000010f604f34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010f51ac15 ___forwarding___ + 1013
4 CoreFoundation 0x000000010f51a798 _CF_forwarding_prep_0 + 120
5 CoreData 0x000000010f09762e -[NSSQLiteConnection execute] + 2270
6 CoreData 0x000000010f0aeaba newFetchedRowsForFetchPlan_MT + 1658
7 CoreData 0x000000010f274467 _executeFetchRequest + 55
8 CoreData 0x000000010f1f3be5 -[NSSQLFetchRequestContext executeRequestUsingConnection:] + 53
9 CoreData 0x000000010f220eb7 __52-[NSSQLDefaultConnectionManager handleStoreRequest:]_block_invoke + 215
10 libdispatch.dylib 0x0000000112b8b0cd _dispatch_client_callout + 8
11 libdispatch.dylib 0x0000000112b6830a _dispatch_barrier_sync_f_invoke + 340
12 CoreData 0x000000010f220d8c -[NSSQLDefaultConnectionManager handleStoreRequest:] + 236
13 CoreData 0x000000010f22861f -[NSSQLCoreDispatchManager routeStoreRequest:] + 351
14 CoreData 0x000000010f1ab7d9 -[NSSQLCore dispatchRequest:withRetries:] + 233
15 CoreData 0x000000010f1a711d -[NSSQLCore processFetchRequest:inContext:] + 93
16 CoreData 0x000000010f09dcf8 -[NSSQLCore executeRequest:withContext:error:] + 568
17 CoreData 0x000000010f191b79 __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke + 5609
18 CoreData 0x000000010f189966 -[NSPersistentStoreCoordinator _routeHeavyweightBlock:] + 390
19 CoreData 0x000000010f09d87e -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 654
20 CoreData 0x000000010f09be24 -[NSManagedObjectContext executeFetchRequest:error:] + 548
21 CoreData 0x000000010f0e154f -[NSManagedObjectContext(_NestedContextSupport) _parentObjectsForFetchRequest:inContext:error:] + 431
22 CoreData 0x000000010f1626b3 __82-[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:]_block_invoke + 611
23 CoreData 0x000000010f0e133d internalBlockToNSManagedObjectContextPerform + 93
24 libdispatch.dylib 0x0000000112b8b0cd _dispatch_client_callout + 8
25 libdispatch.dylib 0x0000000112b6d5e5 _dispatch_barrier_sync_f_slow_invoke + 617
26 libdispatch.dylib 0x0000000112b8b0cd _dispatch_client_callout + 8
27 libdispatch.dylib 0x0000000112b6b8d6 _dispatch_main_queue_callback_4CF + 406
28 CoreFoundation 0x000000010f5594f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
29 CoreFoundation 0x000000010f51ef8d __CFRunLoopRun + 2205
30 CoreFoundation 0x000000010f51e494 CFRunLoopRunSpecific + 420
31 GraphicsServices 0x0000000113b72a6f GSEventRunModal + 161
32 UIKit 0x000000010f9b8f34 UIApplicationMain + 159
33 BlogClient 0x000000010e5a8bdf main + 111
34 libdyld.dylib 0x0000000112bd768d start + 1
35 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I found the issue. Passing an Int64 confuses the argumentArray, casting it to Int fixes the issue.
This seems to be a bug in NSPredicate() filed as radar 28749194
let id:Int64 = 5785905063264256 // Making this Int works
#objc class Test:NSObject {
let postid = id
}
let predicate = NSPredicate(format: "postid == %#"
, argumentArray: [id])
let mytest = Test()
predicate.evaluate(with: mytest) //false but should be true
In CoreData I want to fetch an element by a key. However executing the fetch request results in unrecognized selector sent to instance. The excerpt from my code is shown below, which fails on the last line. managedObjectContext is a valid instance, as I'm also that one to insert new instances. Could this be some incompatibility be with Swift's Int64 and CoreData's Integer 64?
var error : NSError?
var request = NSFetchRequest(entityName: "Node")
var nodeId = NSNumber(longLong: Int64(46763376))
request.predicate = NSPredicate(format: "id = %#", [nodeId])
var nodes = managedObjectContext.executeFetchRequest(request, error: &error)
Entity definition in the datamodel:
Node entity is defined in Swift as:
class Node : NSManagedObject {
#NSManaged var id: NSNumber
#NSManaged var lat: NSNumber
#NSManaged var lon: NSNumber
#NSManaged var tags: NSMutableSet
#NSManaged var ways: NSMutableSet
func description() -> String {
return "Node(id=\(id), lat=\(lat), lon=\(lon))"
}
}
Stack trace:
2014-06-30 08:27:58.238 SwiftApp[35316:1660108] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_TtCSs22ContiguousArrayStorage000000000B6E69C4 longLongValue]: unrecognized selector sent to instance 0xd7d0018'
*** First throw call stack:
(
0 CoreFoundation 0x00864646 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x0218f8e3 objc_exception_throw + 44
2 CoreFoundation 0x0086b575 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
3 CoreFoundation 0x007b6407 ___forwarding___ + 1047
4 CoreFoundation 0x007b5fce _CF_forwarding_prep_0 + 14
5 CoreData 0x0035a125 -[NSSQLiteConnection execute] + 1349
6 CoreData 0x0036e197 -[NSSQLChannel selectRowsWithStatement:] + 119
7 CoreData 0x0037767d newFetchedRowsForFetchPlan_MT + 1741
8 CoreData 0x00362723 -[NSSQLCore newRowsForFetchPlan:] + 403
9 CoreData 0x00361d85 -[NSSQLCore objectsForFetchRequest:inContext:] + 709
10 CoreData 0x00361740 -[NSSQLCore executeRequest:withContext:error:] + 448
11 CoreData 0x0045c6a5 __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke + 2917
12 CoreData 0x00465be8 internalBlockToNSPersistentStoreCoordinatorPerform + 72
13 libdispatch.dylib 0x026a6488 _dispatch_client_callout + 14
14 libdispatch.dylib 0x0268ea38 _dispatch_barrier_sync_f_invoke + 124
15 libdispatch.dylib 0x0268e2c0 dispatch_barrier_sync_f + 89
16 CoreData 0x004574b3 _perform + 99
17 CoreData 0x00361345 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1525
18 CoreData 0x0035f575 -[NSManagedObjectContext executeFetchRequest:error:] + 597
19 SwiftApp 0x000189b6 _TFC8SwiftApp11AppDelegate6parserfS0_FTGSQCSo11NSXMLParser_15didStartElementGSQSS_12namespaceURIGSQSS_13qualifiedNameGSQSS_10attributesGSQCSo12NSDictionary__T_ + 18086
20 SwiftApp 0x0001a335 _TToFC8SwiftApp11AppDelegate6parserfS0_FTGSQCSo11NSXMLParser_15didStartElementGSQSS_12namespaceURIGSQSS_13qualifiedNameGSQSS_10attributesGSQCSo12NSDictionary__T_ + 1221
21 Foundation 0x00d1c00d _startElementNs + 3178
22 libxml2.2.dylib 0x02e8333d xmlParseStartTag2 + 4426
23 libxml2.2.dylib 0x02e860b2 xmlParseTryOrFinish + 3828
24 libxml2.2.dylib 0x02e84fc2 xmlParseChunk + 952
25 Foundation 0x00d19054 -[NSXMLParser parseData:] + 314
26 Foundation 0x00d194f5 -[NSXMLParser parseFromStream] + 276
27 Foundation 0x00d19639 -[NSXMLParser parse] + 33
28 SwiftApp 0x00012b72 _TFC8SwiftApp11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqCSo12NSDictionary__Sb + 1970
29 SwiftApp 0x000133a5 _TToFC8SwiftApp11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqCSo12NSDictionary__Sb + 101
30 UIKit 0x0105bb37 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 291
31 UIKit 0x0105c875 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2920
32 UIKit 0x0105fa33 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1507
33 UIKit 0x01077eb8 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 59
34 UIKit 0x0105e77e -[UIApplication workspaceDidEndTransaction:] + 29
35 FrontBoardServices 0x0381bf1f -[FBSWorkspace clientEndTransaction:] + 87
36 FrontBoardServices 0x038234ed __53-[FBSWorkspaceClient _queue_handleTransactionBookEnd]_block_invoke + 49
37 CoreFoundation 0x00788f90 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 16
38 CoreFoundation 0x0077e133 __CFRunLoopDoBlocks + 195
39 CoreFoundation 0x0077d898 __CFRunLoopRun + 936
40 CoreFoundation 0x0077d22b CFRunLoopRunSpecific + 443
41 CoreFoundation 0x0077d05b CFRunLoopRunInMode + 123
42 UIKit 0x0105e095 -[UIApplication _run] + 571
43 UIKit 0x010616e5 UIApplicationMain + 1526
44 SwiftApp 0x0001e471 top_level_code + 97
45 SwiftApp 0x0001eaeb main + 43
46 libdyld.dylib 0x026d0ac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
The error is here:
request.predicate = NSPredicate(format: "id = %#", [nodeId])
because you pass an array to the "variable argument list" form of predicateWithFormat.
Both of these versions should work:
request.predicate = NSPredicate(format: "id = %#", nodeId)
request.predicate = NSPredicate(format: "id = %#", argumentArray: [nodeId])
Remark: The NSManagedObject documentation states that you are "strongly discouraged"
from overriding the description method in your subclasses.
i have a issues to use a uialertView with a TextFiled in ios 7.
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"title" message:nil delegate:self cancelButtonTitle:#"ok" otherButtonTitles:#"cancel", nil];
alert.alertViewStyle = UIAlertViewStyleSecureTextInput;
[[alert textFieldAtIndex:0] setKeyboardType:UIKeyboardTypeNumberPad];
[alert show];
but in new SDK of ios 7 Creasing and Cresh Can-sol like
AssertMacros: queueEntry, file: /SourceCache/IOKitUser_Sim/IOKitUser-920.1.11/hid.subproj/IOHIDEventQueue.c, line: 512
2013-09-09 10:39:51.659 Food.de[912:a0b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 2 beyond bounds [0 .. 1]'
*** First throw call stack:
(
0 CoreFoundation 0x037a16f4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x02cc08b6 objc_exception_throw + 44
2 CoreFoundation 0x03742616 -[__NSArrayM objectAtIndex:] + 246
3 Food.de 0x0006583f -[HomeViewController addButtonToKeyboard] + 735
4 Food.de 0x00065e8e -[HomeViewController keyboardDidShow:] + 238
5 Foundation 0x02787089 __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke + 40
6 CoreFoundation 0x037fd634 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
7 CoreFoundation 0x0375513b _CFXNotificationPost + 2859
8 Foundation 0x026c0de1 -[NSNotificationCenter postNotificationName:object:userInfo:] + 98
9 UIKit 0x01cb8e97 -[UIInputViewTransition postNotificationsForTransitionEnd] + 1054
10 UIKit 0x01caf4b8 __53-[UIPeripheralHost(UIKitInternal) executeTransition:]_block_invoke1329 + 455
11 UIKit 0x0188dc15 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 306
12 UIKit 0x018778bc -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 267
13 UIKit 0x01877ba4 -[UIViewAnimationState animationDidStop:finished:] + 80
14 QuartzCore 0x00cb2e84 _ZN2CA5Layer23run_animation_callbacksEPv + 304
15 libdispatch.dylib 0x0316b4b0 _dispatch_client_callout + 14
16 libdispatch.dylib 0x03159766 _dispatch_main_queue_callback_4CF + 340
17 CoreFoundation 0x03806b6e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
18 CoreFoundation 0x037477eb __CFRunLoopRun + 1963
19 CoreFoundation 0x03746bf3 CFRunLoopRunSpecific + 467
20 CoreFoundation 0x03746a0b CFRunLoopRunInMode + 123
21 GraphicsServices 0x03e8fa27 GSEventRunModal + 192
22 GraphicsServices 0x03e8f84e GSEventRun + 104
23 UIKit 0x0182bf0b UIApplicationMain + 1225
24 Food.de 0x00006c1d main + 141
25 Food.de 0x00006b85 start + 53
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
if any one develop with ios 7 and know how to solve this problem then help .
.....
if alert.alertViewStyle = UIAlertViewStyleSecureTextInput;
my xcode Version 5.0 (5A11386k)
is not working with ios 7 then we use old strategy like we do for ios 5 ?
thanks .
The problem is on your HomeViewController. You have a
[__NSArrayM objectAtIndex:]: index 2 beyond bounds [0 .. 1]
This means you are trying to access an index that doesn't exists, I think on line 246
A DialogViewController contains an EntryElement and RefreshRequested handler is set (see code below).
Run in the simulator, debug mode, type some quick random text (containing spaces) in the EntryElement. Crash will follow.
What I am doing wrong ?
I guess this is a bug in DialogViewController not retaining some images that is garbage collected.
Is there a switch to trace garbage collector and removed objects ?
the offending code :
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
// class-level declarations
UIWindow window;
UINavigationController navController;
DialogViewController dv ;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create a new window instance based on the screen size
window = new UIWindow (UIScreen.MainScreen.Bounds);
navController = new UINavigationController();
var root = new RootElement("Test") {
new Section("Quick type some text") {
new EntryElement("that contains spaces", string.Empty, string.Empty)
}
};
dv = new DialogViewController(root, true);
dv.RefreshRequested += HandleDvRefreshRequested; // comment this line fixes the bug
window.MakeKeyAndVisible ();
if (UIDevice.CurrentDevice.CheckSystemVersion (5, 0)) {
window.RootViewController = navController;
} else {
window.AddSubview (navController.View);
}
return true;
}
void HandleDvRefreshRequested (object sender, EventArgs e)
{
dv.ReloadComplete();
}
}
Starting iOS simulator 5.0
Launching application
Application launched. PID = 4730
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/System.dll [External]
Thread started:
Loaded assembly: /Users/user/Documents/iphone-cinetoile/Cinetoile.UI2/bin/iPhoneSimulator/Debug/MyApp.exe
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/MonoTouch.Dialog-1.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/Mono.Security.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll [External]
Stacktrace:
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
at MyApp.Application.Main (string[]) [0x00000] in /Users/user/Documents/MyApp/Main.cs:17
at (wrapper runtime-invoke) .runtime_invoke_void_object (object,intptr,intptr,intptr)
Native stacktrace:
0 MyApp 0x000908ec mono_handle_native_sigsegv + 284
1 MyApp 0x00005c88 mono_sigsegv_signal_handler + 248
2 libSystem.B.dylib 0x9141905b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 ??? 0x92c013ef 0x0 + 2462061551
5 ??? 0x92c011ee 0x0 + 2462061038
6 ??? 0x987a313c 0x0 + 2558144828
7 CoreGraphics 0x91b49e20 CGDataProviderRetain + 22
8 ??? 0x9880c456 0x0 + 2558575702
9 ImageIO 0x9754a0d2 CGImageReadCreateWithProvider + 185
10 ImageIO 0x97549fee CGImageSourceCreateWithDataProvider + 186
11 CoreGraphics 0x013c0d2f CGImageCreateWithPNGDataProvider + 87
12 WebCore 0x073ca2a5 WKGraphicsCreateImageFromBundleWithName + 373
13 WebCore 0x06c1c5bd _ZN7WebCore15GraphicsContext23drawLineForTextCheckingERKNS_10FloatPointEfNS0_21TextCheckingLineStyleE + 369
14 WebCore 0x06cf6e84 _ZN7WebCore13InlineTextBox28paintSpellingOrGrammarMarkerEPNS_15GraphicsContextERKNS_10FloatPointERKNS_14DocumentMarkerEPNS_11RenderStyleERKNS_4FontEb + 1684
15 WebCore 0x06cf6fb9 _ZN7WebCore13InlineTextBox20paintDocumentMarkersEPNS_15GraphicsContextERKNS_10FloatPointEPNS_11RenderStyleERKNS_4FontEb + 297
16 WebCore 0x06cf33fc _ZN7WebCore13InlineTextBox5paintERNS_9PaintInfoEiiii + 6490
17 WebCore 0x06cec3cd _ZN7WebCore13InlineFlowBox5paintERNS_9PaintInfoEiiii + 1065
18 WebCore 0x0724d24c _ZN7WebCore13RootInlineBox5paintERNS_9PaintInfoEiiii + 64
19 WebCore 0x071a8e2a _ZNK7WebCore17RenderLineBoxList5paintEPNS_20RenderBoxModelObjectERNS_9PaintInfoEii + 638
20 WebCore 0x07142089 _ZN7WebCore11RenderBlock11paintObjectERNS_9PaintInfoEii + 369
21 WebCore 0x0714248f _ZN7WebCore11RenderBlock5paintERNS_9PaintInfoEii + 307
22 WebCore 0x07141615 _ZN7WebCore11RenderBlock13paintChildrenERNS_9PaintInfoEii + 467
23 WebCore 0x071420ab _ZN7WebCore11RenderBlock11paintObjectERNS_9PaintInfoEii + 403
24 WebCore 0x0714248f _ZN7WebCore11RenderBlock5paintERNS_9PaintInfoEii + 307
25 WebCore 0x07141615 _ZN7WebCore11RenderBlock13paintChildrenERNS_9PaintInfoEii + 467
26 WebCore 0x071420ab _ZN7WebCore11RenderBlock11paintObjectERNS_9PaintInfoEii + 403
27 WebCore 0x0714248f _ZN7WebCore11RenderBlock5paintERNS_9PaintInfoEii + 307
28 WebCore 0x07141615 _ZN7WebCore11RenderBlock13paintChildrenERNS_9PaintInfoEii + 467
29 WebCore 0x071420ab _ZN7WebCore11RenderBlock11paintObjectERNS_9PaintInfoEii + 403
30 WebCore 0x0714248f _ZN7WebCore11RenderBlock5paintERNS_9PaintInfoEii + 307
31 WebCore 0x071961b0 _ZN7WebCore11RenderLayer10paintLayerEPS0_PNS_15GraphicsContextERKNS_7IntRectEjPNS_12RenderObjectEPN3WTF7HashMapIPNS_24OverlapTestRequestClientES4_NS9_7PtrHashISC_EENS9_10HashTraitsISC_EENSF_IS4_EEEEj + 3684
32 WebCore 0x0719648c _ZN7WebCore11RenderLayer10paintLayerEPS0_PNS_15GraphicsContextERKNS_7IntRectEjPNS_12RenderObjectEPN3WTF7HashMapIPNS_24OverlapTestRequestClientES4_NS9_7PtrHashISC_EENS9_10HashTraitsISC_EENSF_IS4_EEEEj + 4416
33 WebCore 0x071973bb _ZN7WebCore11RenderLayer5paintEPNS_15GraphicsContextERKNS_7IntRectEjPNS_12RenderObjectE + 101
34 WebCore 0x06bef809 _ZN7WebCore9FrameView13paintContentsEPNS_15GraphicsContextERKNS_7IntRectE + 591
35 WebKit 0x067a51d0 -[WebFrame(WebInternal) _drawRect:contentsOnly:] + 368
36 WebKit 0x067cc83c -[WebHTMLView drawSingleRect:] + 124
37 WebKit 0x067cc786 -[WebHTMLView drawRect:] + 118
38 WebCore 0x07392c2f _ZL12drawCallbackP6WKView6CGRectPv + 95
39 WebCore 0x073cd52c _ZL11_WKViewDrawP9CGContextP6WKView6CGRectb + 492
40 WebCore 0x073cd61f _ZL11_WKViewDrawP9CGContextP6WKView6CGRectb + 735
41 WebCore 0x073cd61f _ZL11_WKViewDrawP9CGContextP6WKView6CGRectb + 735
42 WebCore 0x073cd61f _ZL11_WKViewDrawP9CGContextP6WKView6CGRectb + 735
43 WebCore 0x073cd61f _ZL11_WKViewDrawP9CGContextP6WKView6CGRectb + 735
44 WebCore 0x073cd80e WKViewDisplayRect + 158
45 WebCore 0x073cead0 WKWindowDrawRect + 48
46 WebCore 0x0735daf0 _ZN7WebCore9TileCache9drawLayerEP9TileLayerP9CGContext + 880
47 WebCore 0x07362af1 -[TileLayer drawInContext:] + 49
48 QuartzCore 0x0417212d _ZL16backing_callbackP9CGContextPv + 88
49 QuartzCore 0x0409215d CABackingStoreUpdate_ + 2636
50 QuartzCore 0x04171fd2 _ZN2CA5Layer8display_Ev + 1370
51 QuartzCore 0x0415fcf1 -[CALayer _display] + 33
52 QuartzCore 0x04166281 _ZN2CA5Layer7displayEv + 165
53 QuartzCore 0x0415fd17 -[CALayer display] + 33
54 QuartzCore 0x04169c5c _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 256
55 QuartzCore 0x040effb9 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 395
56 QuartzCore 0x040f1ea6 _ZN2CA11Transaction6commitEv + 374
57 QuartzCore 0x040f1580 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 80
58 CoreFoundation 0x011959ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
59 CoreFoundation 0x0112c670 __CFRunLoopDoObservers + 384
60 CoreFoundation 0x010f84f6 __CFRunLoopRun + 1174
61 CoreFoundation 0x010f7db4 CFRunLoopRunSpecific + 212
62 CoreFoundation 0x010f7ccb CFRunLoopRunInMode + 123
63 GraphicsServices 0x04789879 GSEventRunModal + 207
64 GraphicsServices 0x0478993e GSEventRun + 114
65 UIKit 0x02190a9b UIApplicationMain + 1175
66 ??? 0x0cda47fd 0x0 + 215631869
67 ??? 0x0cc78ea0 0x0 + 214404768
68 ??? 0x0cc78b98 0x0 + 214403992
69 ??? 0x0cc78cee 0x0 + 214404334
70 MyApp 0x00009ff2 mono_jit_runtime_invoke + 722
71 MyApp 0x00169eee mono_runtime_invoke + 126
72 MyApp 0x0016dfd4 mono_runtime_exec_main + 420
73 MyApp 0x001733f5 mono_runtime_run_main + 725
74 MyApp 0x000671f5 mono_jit_exec + 149
75 MyApp 0x002116c9 main + 2825
76 MyApp 0x00003045 start + 53
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
It's a case of Autocorrection strikes back, aka bug #325 (and quite a few duplicates) and it's not MonoTouch specific.
Something, deep down, the simulated iOS gets corrupted and shows up while it wants to draw it's little red line to show something is misspelled.
This will only happen in the simulator and only when an UITextField has auto-correction enabled. Turning it off like this:
new EntryElement("that contains spaces", string.Empty, string.Empty) {
AutocorrectionType = UITextAutocorrectionType.No
}
will solve the issue (and you can do it only for your simulator builds with a #define).
I am trying to clean up the objects which has status uncompleted. Then I got delete exception while delete these objects from Core Data. Could you help me to point out mistakes? Thanks
Here is the code:
- (void) cleanDownloadQueue {
NSMutableArray *cleanedAssetFiles = [[NSMutableArray alloc] init];
//get objects from context
NSError *error;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setEntity:[self AssetFileEntityDescription]];
NSString *name = #"downloadStatus";
NSInteger value = COMPLETED;
NSPredicate *predicate =[NSPredicate predicateWithFormat:#"%K != %i",name,value];
[fetchRequest setPredicate:predicate];
NSArray *results = [[self.managedObjectContext executeFetchRequest:fetchRequest error:&error] mutableCopy];
//NSLog(#"current length results length: %i", [results count]);
if ([results count] > 0) {
for (NSObject *obj in results){
if ([obj isKindOfClass:[AssetFile class]]) {
AssetFile *assetFile = (AssetFile *) obj;
//assetFile.srAsset.assetFile = nil;
[cleanedAssetFiles addObject:assetFile];
}
}
}
[fetchRequest release];
[results release];
for (AssetFile *afile in cleanedAssetFiles) {
[self.managedObjectModel delete:afile];
}
if ([cleanedAssetFiles count] > 0) {
[self saveManagedObjectChanges];
}
[cleanedAssetFiles release];
}
And here is the log:
<Error>: -[NSManagedObjectModel delete:]: unrecognized selector sent to instance 0x1d8dd0
May 19 21:57:10 unknown DMC to Go[1182] <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSManagedObjectModel delete:]: unrecognized selector sent to instance 0x1d8dd0'
*** Call stack at first throw:
(
0 CoreFoundation 0x32a9d64f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x35475c5d objc_exception_throw + 24
2 CoreFoundation 0x32aa11bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x32aa0649 ___forwarding___ + 508
4 CoreFoundation 0x32a17180 _CF_forwarding_prep_0 + 48
5 DMC to Go 0x0000483f -[dmcIpadAppDelegate cleanDownloadQueue] + 934
6 DMC to Go 0x0001b617 +[DmcIpadAppDelegate cleanDownloadQueue] + 82
7 DMC to Go 0x0000b35d -[SRListViewController viewDidLoad] + 40
8 UIKit 0x3262cf0f -[UIViewController view] + 110
9 UIKit 0x3263b5ef -[UIViewController contentScrollView] + 22
10 UIKit 0x3263b45f -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 30
11 UIKit 0x3263b35d -[UINavigationController _layoutViewController:] + 24
12 UIKit 0x3263ae35 -[UINavigationController _startTransition:fromViewController:toViewController:] + 380
13 UIKit 0x3263ac43 -[UINavigationController _startDeferredTransitionIfNeeded] + 182
14 UIKit 0x3263ab87 -[UINavigationController viewWillLayoutSubviews] + 14
15 UIKit 0x3263ab23 -[UILayoutContainerView layoutSubviews] + 138
16 UIKit 0x325fb5fb -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 26
17 CoreFoundation 0x32a0af03 -[NSObject(NSObject) performSelector:withObject:] + 22
18 QuartzCore 0x35f3bbb5 -[CALayer layoutSublayers] + 120
19 QuartzCore 0x35f3b96d CALayerLayoutIfNeeded + 184
20 QuartzCore 0x35f3b8a7 -[CALayer layoutIfNeeded] + 78
21 UIKit 0x325fb5d7 -[UIView(Hierarchy) layoutIfNeeded] + 22
22 UIKit 0x326a3775 -[UIViewController window:willAnimateRotationToInterfaceOrientation:duration:] + 356
23 UIKit 0x326a2bc1 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 3100
24 UIKit 0x326a6677 -[UIWindow _setRotatableViewOrientation:duration:force:] + 54
25 UIKit 0x3263a8eb -[UIWindow _updateToInterfaceOrientation:duration:force:] + 74
26 UIKit 0x32639551 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 540
27 UIKit 0x326390ad -[UIWindow setDelegate:] + 168
28 UIKit 0x32638fa9 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 64
29 UIKit 0x32637611 -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:] + 460
30 UIKit 0x326165a7 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 506
31 UIKit 0x3261632f -[UIView(Hierarchy) _postMovedFromSuperview:] + 106
32 UIKit 0x325fbc1b -[UIView(Internal) _addSubview:positioned:relativeTo:] + 678
33 UIKit 0x325fb96b -[UIView(Hierarchy) addSubview:] + 22
34 UIKit 0x3262b35f -[UIWindow addRootViewControllerViewIfPossible] + 202
35 UIKit 0x3275653f -[UIWindow setRootViewController:] + 166
36 DMC to Go 0x00003055 -[dmcIpadAppDelegate application:didFinishLaunchingWithOptions:] + 792
37 UIKit 0x3262b821 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 772
38 UIKit 0x32625b65 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 272
39 UIKit 0x325fa7d7 -[UIApplication handleEvent:withNewEvent:] + 1114
40 UIKit 0x325fa215 -[UIApplication sendEvent:] + 44
41 UIKit 0x325f9c53 _UIApplicationHandleEvent + 5090
42 GraphicsServices 0x358d2e77 PurpleEventCallback + 666
43 CoreFoundation 0x32a74a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
44 CoreFoundation 0x32a7683f __CFRunLoopDoSource1 + 166
45 CoreFoundation 0x32a7760d __CFRunLoopRun + 520
46 CoreFoundation 0x32a07ec3 CFRunLoopRunSpecific + 230
47 CoreFoundation 0x32a07dcb CFRunLoopRunInMode + 58
48 UIKit 0x32624d49 -[UIApplication _run] + 372
49 UIKit 0x32622807 UIApplicationMain + 670
50 DMC to Go 0x00002927 main + 82
51 DMC to Go 0x000028d0 start + 40
You can not delete objects with your managedObjectModel.
Only the managedObjectContext can delete objects:
for (AssetFile *afile in cleanedAssetFiles) {
[afile.managedObjectContext delete:afile];
}