0

This checks my collection view if there is something called "BETA". When this is the case, it should look what the itemID of it is. This should be brought together and return something like "2 4" in a plist file.

In my log I get "Teststring 2" and "Teststring 4" but what I need is that it logs "Teststring 2 4". So it needs to bring those two values together.

Click here to see the log

The Array:

  self.content = [NSMutableArray arrayWithObjects:
                      @{@"itemTitle":@"Passave",
                        @"itemVersion":@"1.2.0.1",
                        @"itemBundleID":@"com.Stormar.Passave",
                        @"itemID":@"0",
                        @"itemDescription":@"Fill in your password quick.",
                        @"itemPrice":@"€19,99",
                        @"itemUrlDownload":@"https://www.dropbox.com/s/vf0wdc3bnida3mb/Passave.zip?dl=0",
                        @"itemImage":@"https://upload.wikimedia.org/wikipedia/commons/a/a1/Passave.png"},

                      @{@"itemTitle":@"TopRadio",
                        @"itemVersion":@"1.3",
                        @"itemBundleID":@"Stormar.TopRadio",
                        @"itemID":@"1",
                        @"itemDescription":@"Listen to music from TopRadio!",
                        @"itemPrice":@"FREE",
                        @"itemUrlDownload":@"http://topradiodownloalink.com",
                        @"itemImage":@"https://upload.wikimedia.org/wikipedia/commons/0/0e/TopRadio.png"},

                      @{@"itemTitle":@"Shifter",
                        @"itemVersion":@"1.0",
                        @"itemBundleID":@"com.Stormar.Shifter",
                        @"itemID":@"2",
                        @"itemDescription":@"Switch your symbols with numbers!",
                        @"itemPrice":@"BETA",
                        @"itemUrlDownload":@"http://shifterdownloalink.com",
                        @"itemImage":@"https://upload.wikimedia.org/wikipedia/commons/0/07/Shifter.png"},

                      @{@"itemTitle":@"Spammer",
                        @"itemVersion":@"1.1.0",
                        @"itemBundleID":@"com.Stormar.Spammer",
                        @"itemID":@"3",
                        @"itemDescription":@"Spam your friends ;)",
                        @"itemPrice":@"FREE",
                        @"itemUrlDownload":@"http://spammerdownloalink.com",
                        @"itemImage":@"https://upload.wikimedia.org/wikipedia/commons/c/c4/Spammerl.png"},

                      @{@"itemTitle":@"Mucow Creator",
                        @"itemVersion":@"0.1.2",
                        @"itemBundleID":@"com.Stormar.Mucow-Creator",
                        @"itemID":@"4",
                        @"itemDescription":@"Create your own Adobe Muse Widgets!",
                        @"itemPrice":@"BETA",
                        @"itemUrlDownload":@"http://mucowcreatordownloalink.com",
                        @"itemImage":@"https://upload.wikimedia.org/wikipedia/commons/0/06/Mucow_Creator.png"},

                    nil];

The Code:

if ([[self.representedObject valueForKey:@"itemPrice"] isEqualToString:@"BETA"]) {
            NSLog(@"BETA YES ID : %@", [self.representedObject valueForKey:@"itemID"]);

            NSMutableString *teststring = [[NSMutableString alloc]init];
            [teststring appendString:[self.representedObject valueForKey:@"itemID"]];
            NSLog(@"Teststring %@", teststring);
            [Functions saveDataToPlist:plistPathSMSettings OfType:@"String" Value:teststring ForKey:betaDef];
        }

1 Answers1

0

.h file

NSMutableString *teststring;

.m file

teststring = [[NSMutableString alloc]init];
NSLog(@"Teststring 1: %@", teststring);

NSString* LibraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *plistPathSMSettings = [LibraryPath stringByAppendingString:stormarManagerSettingsPlistPath];

NSString *betaKeyDef = [SMSettingsDEF stringByAppendingString:@"BETA's"];
NSString *betaDef = [SMInAppCommunicationDEF stringByAppendingString:@"BETA App Id"];

NSString *isBeta = [Functions readDataFromPlist:plistPathSMSettings ForKey:betaKeyDef];

if ([isBeta isEqualToString:@"YES"]) {
    [Functions saveDataToPlist:plistPathSMSettings OfType:@"String" Value:@"" ForKey:betaDef];
}
else if ([isBeta isEqualToString:@"NO"]) {
    if ([[self.representedObject valueForKey:@"itemPrice"] isEqualToString:@"BETA"]) {
        NSLog(@"BETA YES ID : %@", [self.representedObject valueForKey:@"itemID"]);
        NSLog(@"Teststring 2: %@", teststring);
        NSString *theString = [teststring stringByAppendingString:[self.representedObject valueForKey:@"itemID"]];
        NSLog(@"Teststring 2 1: %@", theString);
        [teststring appendString:theString];
        NSLog(@"Teststring 3: %@", teststring);
        //[Functions saveDataToPlist:plistPathSMSettings OfType:@"String" Value:teststring ForKey:betaDef];
    }
}

Log file

2016-06-28 00:33:49.368503 Stormar Manager[61304:4951263] Teststring 1:
2016-06-28 00:33:49.372203 Stormar Manager[61304:4951263] Teststring 1:
2016-06-28 00:33:49.377497 Stormar Manager[61304:4951263] Teststring 1:
2016-06-28 00:33:49.380680 Stormar Manager[61304:4951263] Teststring 1:
2016-06-28 00:33:49.381017 Stormar Manager[61304:4951263] Teststring 1:
2016-06-28 00:33:49.381130 Stormar Manager[61304:4951263] BETA YES ID : 2
2016-06-28 00:33:49.381148 Stormar Manager[61304:4951263] Teststring 2:
2016-06-28 00:33:49.381172 Stormar Manager[61304:4951263] Teststring 2 1: 2
2016-06-28 00:33:49.381182 Stormar Manager[61304:4951263] Teststring 3: 2
2016-06-28 00:33:49.381519 Stormar Manager[61304:4951263] Teststring 1:
2016-06-28 00:33:49.421572 Stormar Manager[61304:4951263] Teststring 1:
2016-06-28 00:33:49.421755 Stormar Manager[61304:4951263] BETA YES ID : 4
2016-06-28 00:33:49.421772 Stormar Manager[61304:4951263] Teststring 2:
2016-06-28 00:33:49.421781 Stormar Manager[61304:4951263] Teststring 2 1: 4
2016-06-28 00:33:49.421789 Stormar Manager[61304:4951263] Teststring 3: 4

Image of the log