2つのNSArrayを比較するはるかに高速な方法はありますか?ニックネームが2つの配列に存在するかどうかを知り、それらのインデックスを取得する必要があります。
私の方法を見てください私たちはもっと速く何かをすることができると思います
-(void)classPseudo
{
AppDelegate *app = [[UIApplication sharedApplication]delegate];
NSString * documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *fullFileName = [NSString stringWithFormat:@"%@/contactArray.txt", documentsPath];
NSMutableArray *newOnlineArray = [[NSMutableArray alloc]initWithContentsOfFile:fullFileName];
NSUInteger count = [newOnlineArray count];
NSUInteger count2 = [app.messagePseudo count];
for (NSUInteger index = 0; index < count; index++)
{
for (NSUInteger index2 = 0; index2 < count2; index2++)
{
dict1= [newOnlineArray objectAtIndex:index];
st1 = [dict1 objectForKey:@"pseudo"];
dict2= [app.messagePseudo objectAtIndex:index2];
st2 = [dict2 objectForKey:@"expediteur"];
if ([st2 isEqualToString:st1])
{
NSLog(@"YESS %d",index);
}
else {
NSLog(@"NOOOON");
}
}
}
}
ヘルプが適用されます。事前に感謝します。