Ein @property geht nicht

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Ein @property geht nicht

    Hallo,
    Ich habe einen Fehler, den ich nicht verstehe.

    Fehlermeldung:

    Quellcode

    1. ​2015-02-02 13:26:56.934 Overdue Assignment 2[1843:513592] -[OATask setTaskDescription:]: unrecognized selector sent to instance 0x7fb6b84277f0
    2. 2015-02-02 13:26:56.935 Overdue Assignment 2[1843:513592] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[OATask setTaskDescription:]: unrecognized selector sent to instance 0x7fb6b84277f0'
    3. *** First throw call stack:
    4. (
    5. 0 CoreFoundation 0x000000011025af35 __exceptionPreprocess + 165
    6. 1 libobjc.A.dylib 0x000000010fef3bb7 objc_exception_throw + 45
    7. 2 CoreFoundation 0x000000011026204d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    8. 3 CoreFoundation 0x00000001101ba27c ___forwarding___ + 988
    9. 4 CoreFoundation 0x00000001101b9e18 _CF_forwarding_prep_0 + 120
    10. 5 Overdue Assignment 2 0x000000010f9c085a -[OAAddTaskViewController returnTask] + 330
    11. 6 Overdue Assignment 2 0x000000010f9c06b9 -[OAAddTaskViewController buttonAddPressed:] + 89
    12. 7 UIKit 0x00000001106488be -[UIApplication sendAction:to:from:forEvent:] + 75
    13. 8 UIKit 0x000000011074f410 -[UIControl _sendActionsForEvents:withEvent:] + 467
    14. 9 UIKit 0x000000011074e7df -[UIControl touchesEnded:withEvent:] + 522
    15. 10 UIKit 0x000000011068e308 -[UIWindow _sendTouchesForEvent:] + 735
    16. 11 UIKit 0x000000011068ec33 -[UIWindow sendEvent:] + 683
    17. 12 UIKit 0x000000011065b9b1 -[UIApplication sendEvent:] + 246
    18. 13 UIKit 0x0000000110668a7d _UIApplicationHandleEventFromQueueEvent + 17370
    19. 14 UIKit 0x0000000110644103 _UIApplicationHandleEventQueue + 1961
    20. 15 CoreFoundation 0x0000000110190551 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    21. 16 CoreFoundation 0x000000011018641d __CFRunLoopDoSources0 + 269
    22. 17 CoreFoundation 0x0000000110185a54 __CFRunLoopRun + 868
    23. 18 CoreFoundation 0x0000000110185486 CFRunLoopRunSpecific + 470
    24. 19 GraphicsServices 0x00000001138299f0 GSEventRunModal + 161
    25. 20 UIKit 0x0000000110647420 UIApplicationMain + 1282
    26. 21 Overdue Assignment 2 0x000000010f9c0533 main + 115
    27. 22 libdyld.dylib 0x00000001127ea145 start + 1
    28. 23 ??? 0x0000000000000001 0x0 + 1
    29. )
    30. libc++abi.dylib: terminating with uncaught exception of type NSException
    31. (lldb)
    Alles anzeigen


    meine Vermutung: setTaskDescription funktioniert nicht. Aber warum?

    Meine OATask.h:

    Quellcode

    1. ​#import <Foundation/Foundation.h>
    2. @interface OATask : NSObject
    3. @property (nonatomic, strong) NSString *title; //das geht
    4. @property (nonatomic, strong) NSDate *date;
    5. @property (nonatomic) BOOL isCompleted;
    6. @property (nonatomic, strong) NSString *taskDescription; //das geht nicht
    7. @end
    Alles anzeigen


    Wie ich da reinkommentiert habe, sind das zwei Strings drinne: davon geht einer, der andere aber nicht.

    Die Zeile in der das abstürtzt ist in der

    OAAddTaskViewController.m

    Quellcode

    1. ​}
    2. - (IBAction)buttonAddPressed:(UIButton *)sender {
    3. [self.delegate didAddTask:[self returnTask]];
    4. }
    5. #pragma mark - Helper Method
    6. -(OATask *)returnTask
    7. {
    8. OATask *task = [[OATask alloc] init];
    9. task.title = self.textView.text;
    10. task.date = self.datePicker.date;
    11. task.isCompleted = NO;
    12. task.taskDescription= self.textView.text;
    13. return task;
    14. }
    Alles anzeigen



    Wieder sieht man, zwischen task.title und task.description ist kaum unterschied.

    Wenn ich jetzt eine neue @property erstelle, geht es auch nicht, egal welchen Namen ich nehme, also kann es auch nicht sein, dass es daran liegt, dass es schon ein setTaskDescription gibt.


    Wahrscheinlich übersehe ich einfach wieder was :/
  • gandhi schrieb:

    Gibt's die Klasse OATask evtl. doppelt? Einmal eine "fremde", die zufällig auch die Methode "setTitle:" unterstützt, und Deine? Oder hast Du zufällig zwei Impl-Files, wobei das korrekte nicht Deinem Target hinzugefügt ist und Du also das falsche editiert hast?

    Sowas wird's sein

    ciao

    gandhi


    Ich werde gleich die Klasse umbenennen und das ausprobieren. aber dann müsste sie ja auch setDate, setTitle und setIsCompleted unterstützen und gleichzeitig den gleich Präfix nutzen wie ich.. Das kam mir irgendwie sehr unwahrscheinlich vor.