UIAlertViewStyleSecureTextInput not working with ios 7 - iphone-5

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

Related

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType pointSize]

when I want to generate a canvas on node this error is displayed and I don't know how to fix the problem.
2022-11-28 15:16:20.203 node[72232:1100211] -[__NSCFType pointSize]: unrecognized selector sent to instance 0x6000005e34e0
2022-11-28 15:16:20.210 node[72232:1100211] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType pointSize]: unrecognized selector sent to instance 0x6000005e34e0'
*** First throw call stack:
(
0 CoreFoundation 0x00007ff80ea337c3 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007ff80e793bc3 objc_exception_throw + 48
2 CoreFoundation 0x00007ff80eab836b -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x00007ff80e99a515 ___forwarding___ + 1356
4 CoreFoundation 0x00007ff80e999f38 _CF_forwarding_prep_0 + 120
5 UIFoundation 0x00007ff81224426c +[NSFont initialize] + 381
6 libobjc.A.dylib 0x00007ff80e7864e5 CALLING_SOME_+initialize_METHOD + 17
7 libobjc.A.dylib 0x00007ff80e7861ee initializeNonMetaClass + 736
8 libobjc.A.dylib 0x00007ff80e785f6a initializeNonMetaClass + 92
9 libobjc.A.dylib 0x00007ff80e785f6a initializeNonMetaClass + 92
10 libobjc.A.dylib 0x00007ff80e785c18 _ZL24initializeAndMaybeRelockP10objc_classP11objc_objectR8mutex_ttILb0EEb + 232
11 libobjc.A.dylib 0x00007ff80e785995 lookUpImpOrForward + 1087
12 libobjc.A.dylib 0x00007ff80e78853d object_setClass + 88
13 CoreFoundation 0x00007ff80e93bd78 _CFRuntimeCreateInstance + 544
14 CoreText 0x00007ff810026f23 _Z11TCFBase_NEWI6CTFontJPK18__CTFontDescriptorRdRPK17CGAffineTransformRS3_EE6TCFRefIPT_EDpOT0_ + 43
15 CoreText 0x00007ff810026e1e CTFontCreateWithFontDescriptor + 108
16 libpangocairo-1.0.0.dylib 0x000000014572e9a2 _pango_cairo_core_text_font_new + 96
17 libpangocairo-1.0.0.dylib 0x000000014572d963 pango_core_text_font_map_new_font + 143
18 libpangocairo-1.0.0.dylib 0x000000014572d6a7 pango_core_text_fontset_new + 417
19 libpangocairo-1.0.0.dylib 0x000000014572d173 pango_core_text_font_map_load_fontset + 126
20 libpango-1.0.0.dylib 0x000000014585441d pango_itemize_with_font + 1249
21 libpango-1.0.0.dylib 0x000000014585f0d3 pango_layout_check_lines + 828
22 libpango-1.0.0.dylib 0x0000000145861993 pango_layout_get_line + 27
23 canvas.node 0x00000001456d16ca _ZN9Context2d11setTextPathEdd + 154
24 canvas.node 0x00000001456d14e0 _Z9paintTextRKN3Nan20FunctionCallbackInfoIN2v85ValueEEEb + 928
25 canvas.node 0x00000001456adfad _ZN3Nan3impL23FunctionCallbackWrapperERKN2v820FunctionCallbackInfoINS1_5ValueEEE + 189
26 node 0x00000001034d7589 _ZN2v88internal25FunctionCallbackArguments4CallENS0_15CallHandlerInfoE + 265
27 node 0x00000001034d7056 _ZN2v88internal12_GLOBAL__N_119HandleApiCallHelperILb0EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateENS0_6HandleINS0_10HeapObjectEEESA_NS8_INS0_20FunctionTemplateInfoEEENS8_IS4_EENS0_16BuiltinArgumentsE + 550
28 node 0x00000001034d67cf _ZN2v88internal21Builtin_HandleApiCallEiPmPNS0_7IsolateE + 255
29 node 0x0000000103d4b439 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit + 57
30 node 0x0000000103cdde2a Builtins_InterpreterEntryTrampoline + 202
)
libc++abi: terminating with uncaught exception of type NSException
node version: 16;17.1
I tried to change the version of node, to reinstall the canvas package, it did not change anything.

ios15,WKWebView,UITextField crash

iOS15 system:
1.click UITextField crash
2.Click the second layer WebView to crash
log:
Incident Identifier: 4F61CB1C-53DB-4EFD-B38F-93B973BE5CCC
CrashReporter Key: 6fa29e4a6b7c708a032c474dff75ab04a89a6a5e Hardware
Model: iPhone12,5 Process: AppName [2986] Path:
/private/var/containers/Bundle/Application/***/AppName.app/AppName
Identifier: com.***** Version: 8.0.0 (1) Code Type: ARM-64 (Native)
Role: Foreground Parent Process: launchd [1] Coalition: com.*****
[1262] Date/Time: 2022-01-28 16:14:58.8262 +0800 Launch Time:
2022-01-28 16:14:41.9927 +0800 OS Version: iPhone OS 15.2.1 (19C63)
Release Type: User Baseband Version: 3.01.02 Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes:
0x0000000000000001, 0x00000001812e01ec Exception Note:
EXC_CORPSE_NOTIFY Termination Reason: SIGNAL 5 Trace/BPT trap: 5
Terminating Process: 888 handler [2986] Triggered by Thread: 0 Thread
0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0
CoreFoundation 0x1812e01ec __NSI0 + 748 1 CoreFoundation 0x181333ad4
-[NSInvocation getArgument:atIndex:] + 148 2 Foundation 0x182b4f0dc _NSGetValueWithMethod + 220 3 Foundation 0x182b0ab2c -[NSObject(NSKeyValueCoding) valueForKey:] + 320 4 AccessibilityUtilities 0x196f8787c
__57-[NSObject(UIAccessibilitySafeCategory) safeValueForKey:]_block_invoke + 40 5 AccessibilityUtilities
0x196f87640 -[NSObject(UIAccessibilitySafeCategory)
_accessibilityPerformSafeValueKeyBlock:withKey:onClass:] + 96 6 AccessibilityUtilities 0x196f879a4
-[NSObject(UIAccessibilitySafeCategory) safeValueForKey:] + 240 7 UIKit 0x1f2042e38 -[UIViewControllerAccessibility
_accessibilityLoadAccessibilityInformation] + 144 8 UIAccessibility 0x198c430e0 -[UIAccessibilityInformationLoader
_loadAccessibilityInformationOnMainThread:] + 828 9 Foundation 0x182b15780 __NSFireTimer + 104 10 CoreFoundation 0x18136e318
[CFRUN IS_CALLING_OUT_TO A_TIMER_CALLBACK_FUNCTION] + 32 11
CoreFoundation 0x1812f2cf0 __CFRunLoopDoTimer + 1076 12
CoreFoundation 0x1812ed4ec __CFRunLoopDoTimers + 328 13
CoreFoundation 0x1812cbd08 __CFRunLoopRun + 1944 14 CoreFoundation
0x1812df468 CFRunLoopRunSpecific + 600 15 GraphicsServices
0x19ce6a38c GSEventRunModal + 164 16 UIKitCore 0x183c81088
-[UIApplication _run] + 1100 17 UIKitCore 0x1839ff958 UIApplicationMain + 2092 18 AppName 0x10060fed0 main + 352 19 dyld
0x105151aa4 start + 520 .......
问题在avoidCrash中,
[AvoidCrash makeAllEffective];改成[AvoidCrash becomeEffective];不再全局捕获
发现崩溃在avoidCrashMethodSignatureForSelector:
这个方法里转发底层方法_navigationControllerContentInsetAdjustment时候崩溃

Core Data, NSPredicate causes NSInvalidArgumentException

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

CoreData fetchRequest results in uncaught exception

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.

App is crashing in a certain line, Why?

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 .

Resources