Probleme mit Array

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

  • Probleme mit Array

    Ich habe ein Problem: Das Programm stürzt immer ab... (SIGABRT Markiert) Sämtliche Variablen sind vom Typ NSString, die von myKeys NSButton.
    Die Funktion ReadPlist funktioniert Perfekt, wenn ich ihr die Variablen manuell überreiche. Ich habe den Eindruck, dass die Variablen nicht wieder als NSString herauskommen... wo ist das Problem? Danke im voraus!!!

    Quellcode

    1. NSMutableArray *myDomains;
    2. NSMutableArray *myKeys;
    3. NSMutableArray *myCheckboxes;
    4. [myDomains initWithObjects:dfinder, dquicktime, ddvd, ddashboard, ddiskutility, ddisk, ddock, diTunes, dsafari, dmail, dcrash, dlaunch, g, @"NSGlobalDomain", nil];
    5. [myKeys initWithObjects:k_fi_ada, k_fi_apidta, k_fi_ed, k_fi_iadda, k_fi_idma, k_fi_pse, k_fi_pv, k_fi_vda, k_fi_wa, k_fi_wbdda, k_fi_wbpa, k_qpx_bda, k_qpx_fbss, k_qpx_fhkae, k_qpx_tda, k_qpx_vbpv, k_dvd_aiiv, k_dvd_dvdbeaa, k_d_dd, k_d_dm, k_fe_eifa, k_fe_bvd, k_d_sule, k_d_2dda, k_i_dpndta, k_i_dpndtd, k_i_hsbdbe, k_o_dkisa, k_o_emika, k_o_bhan, k_o_abe, k_o_dsudie, k_o_ad, nil];
    6. [myCheckboxes initWithObjects:Fi_ada, Fi_APidTa, Fi_ed, Fi_iadda, Fi_idma, Fi_pse, Fi_pv, Fi_Vda, Fi_wa, Fi_wbdda, Fi_wbpa, QPX_Bda, QPX_Fbss, QPX_fhkae, QPX_Tda, QPX_vbpv, DVDP_Aiiv, DVDP_DVDbeaa, D_dd, D_dm, Fe_EIFa, Fe_bvd, D_sule, D_2dda, I_dpndta, I_dpndtd, I_hsbdbe, O_dkisa, O_bhan, O_abe, O_dsudie, O_ad, nil];
    7. for (int i = 0; i < 33; i++) {
    8. int location;
    9. {
    10. if (i < 11) {
    11. location = 0;
    12. } else if (i < 16) {
    13. location = 1;
    14. } else if (i < 18) {
    15. location = 2;
    16. } else if (i < 20) {
    17. location = 3;
    18. } else if (i < 21) {
    19. location = 4;
    20. } else if (i < 22) {
    21. location = 5;
    22. } else if (i < 24) {
    23. location = 6;
    24. } else if (i < 27) {
    25. location = 7;
    26. } else if (i < 28) {
    27. location = 8;
    28. } else if (i < 29) {
    29. location = 9;
    30. } else if (i < 30) {
    31. location = 11;
    32. } else if (i < 32) {
    33. location = 12;
    34. } else if (i < 33) {
    35. location = 13;
    36. }
    37. }
    38. NSString *toWrite = @"Reading ";
    39. NSString *MyDomains = [myDomains objectAtIndex:location];
    40. NSString *MyKey = [myKeys objectAtIndex:i];
    41. NSButton *temp = [myCheckboxes objectAtIndex:i];
    42. toWrite = [toWrite stringByAppendingString:MyDomains]; //Thread 1 SIGABRT
    43. toWrite = [toWrite stringByAppendingString:@" "];
    44. toWrite = [toWrite stringByAppendingString:MyKey];
    45. NSLog(@"%@", toWrite);
    46. if (readPlist(MyDomains, MyKey)) {
    47. [temp setState:NSOnState];
    48. } else {
    49. [temp setState:NSOffState];
    50. }}
    Alles anzeigen
  • BPcM schrieb:

    So was passiert mir andauernd... auch wenn ich 5 mal drüberlese...

    -initWith... ist doch aber keine Klassenmethode.
    Macht es dich nicht stutzig, dass die Codevervollständigung dir das nicht anbietet? 8|
    «Applejack» "Don't you use your fancy mathematics to muddle the issue!"

    Iä-86! Iä-64! Awavauatsh fthagn!

    kmr schrieb:

    Ach, Du bist auch so ein leichtgläubiger Zeitgenosse, der alles glaubt, was irgendwelche Typen vor sich hin brabbeln. :-P
  • Amin Negm-Awad schrieb:

    BPcM schrieb:

    Danke... ich auch :D

    So was passiert mir andauernd... auch wenn ich 5 mal drüberlese...

    Besser wäre es, einmal die Compiler-Warnings zu lesen … ;)

    Diese nervigen Dinger lassen sich mit -Wnone sicherlich ausblenden. ^^
    «Applejack» "Don't you use your fancy mathematics to muddle the issue!"

    Iä-86! Iä-64! Awavauatsh fthagn!

    kmr schrieb:

    Ach, Du bist auch so ein leichtgläubiger Zeitgenosse, der alles glaubt, was irgendwelche Typen vor sich hin brabbeln. :-P
  • Lucas de Vil schrieb:

    -initWith... ist doch aber keine Klassenmethode.

    Er schickt initWith... ja auch nicht an ein Klassenobjekt.

    Amin Negm-Awad schrieb:

    BPcM schrieb:

    Danke... ich auch :D

    So was passiert mir andauernd... auch wenn ich 5 mal drüberlese...

    Besser wäre es, einmal die Compiler-Warnings zu lesen … ;)

    Ich habe es jetzt nicht ausprobiert, aber ich habe da so meine Zweifel, dass der Compiler hier warnen würde.

    Michael
  • Michael schrieb:

    Lucas de Vil schrieb:

    -initWith... ist doch aber keine Klassenmethode.

    Er schickt initWith... ja auch nicht an ein Klassenobjekt.

    Amin Negm-Awad schrieb:

    BPcM schrieb:

    Danke... ich auch :D

    So was passiert mir andauernd... auch wenn ich 5 mal drüberlese...

    Besser wäre es, einmal die Compiler-Warnings zu lesen … ;)

    Ich habe es jetzt nicht ausprobiert, aber ich habe da so meine Zweifel, dass der Compiler hier warnen würde.

    Michael

    Arg, du hast natürlich Recht!

    Wobei, dem Analyzer traue ich es sogar zu, jedenfalls bei ARC.
    Es hat noch nie etwas gefunzt. To tear down the Wall would be a Werror!
    25.06.2016: [Swift] gehört zu meinen *Favorite Tags* auf SO. In welcher Bedeutung von "favorite"?
  • Michael schrieb:

    Lucas de Vil schrieb:

    -initWith... ist doch aber keine Klassenmethode.

    Er schickt initWith... ja auch nicht an ein Klassenobjekt.

    Arg. Stimmt.
    Eher an nil oder sonstwas. -.-
    Und da presentiert Autovervollständigung frecherweise auch noch die Methoden.
    «Applejack» "Don't you use your fancy mathematics to muddle the issue!"

    Iä-86! Iä-64! Awavauatsh fthagn!

    kmr schrieb:

    Ach, Du bist auch so ein leichtgläubiger Zeitgenosse, der alles glaubt, was irgendwelche Typen vor sich hin brabbeln. :-P