Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You're not appending a string, you're simply setting <code>repeat</code> to a new string. Maybe you want this?</p> <pre><code>app.repeat = [NSString stringWithFormat:@"%@%@", app.repeat, @"Every Friday"]; </code></pre> <p>Or even simpler, this?</p> <pre><code>app.repeat = [app.repeat stringByAppendingString:@"Every Friday"]; </code></pre> <p>Also, you have a leak; you alloc an array and then you lose reference to it by assigning to it the returned object from <code>[[NSUserDefaults standardUserDefaults]objectForKey:@"week"]</code>.</p> <p>EDIT: Well, your original code was spaghetti - and my code won't help - but here's what you could do (though I would never do this myself):</p> <pre><code>BOOL alreadyModified = NO; if (sun) { app.repeat = @"Every Sunday"; alreadyModified = YES; NSLog(@"weekday:%@",app.repeat); } if (mon) { if (alreadyModified) { app.repeat = [app.repeat stringByAppendingString:@", Monday"]; } else { app.repeat= @"Every Monday"; alreadyModified = YES; } NSLog(@"weekday:%@",app.repeat); } if(tue) { if (alreadyModified) { app.repeat = [app.repeat stringByAppendingString:@", Tuesday"]; } else { app.repeat= @"Every Tuesday"; alreadyModified = YES; } NSLog(@"weekday:%@",app.repeat); } if(wed) { if (alreadyModified) { app.repeat = [app.repeat stringByAppendingString:@", Wednesday"]; } else { app.repeat= @"Every Wednesday"; alreadyModified = YES; } NSLog(@"weekday:%@",app.repeat); } if(thu) { if (alreadyModified) { app.repeat = [app.repeat stringByAppendingString:@", Thursday"]; } else { app.repeat= @"Every Thursday"; alreadyModified = YES; } NSLog(@"weekday:%@",app.repeat); } if(fri) { if (alreadyModified) { app.repeat = [app.repeat stringByAppendingString:@", Friday"]; } else { app.repeat= @"Every Friday"; alreadyModified = YES; } NSLog(@"weekday:%@",app.repeat); } if(sat) { if (alreadyModified) { app.repeat = [app.repeat stringByAppendingString:@", Saturday"]; } else { app.repeat= @"Every Saturday"; alreadyModified = YES; } NSLog(@"weekday:%@",app.repeat); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload