I'm trying to write an IF ELSE statement to enable shipping, If user doesn't add an address the array contents remain as "-" & "-" for the two items in the array. I want to check to see if those are in the array, if they are then I want to enableshipping.
Here is the code for getting the array:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fullFileName = [NSString stringWithFormat:@"%@/arraySaveFile", documentsDirectory];
NSMutableArray *array = [[NSMutableArray alloc] initWithContentsOfFile:fullFileName];
How do I write this first line to look for the "-" & "-"?
if ([fullFileName isEqualToString:@"-","-"])
{
[nnNEP EnableShipping];
}
else {
[nnNEP DisableShipping];
}
Thanks,
开发者_Python百科michael
I think you want to check the contents of the first two items of the array and not fullFileName.
For example:
if ([[array objectAtIndex:0] isEqualToString:@"-"]
&& [[array objectAtIndex:1] isEqualToString:@"-"])
{
[nnNEP EnableShipping];
}
else
{
[nnNEP DisableShipping];
}
精彩评论