實例代碼
if([_arr containsObject:peripheral]){
return;
}else{
[_arr addObject:peripheral];
}
文檔
@interface NSArray<ObjectType> (NSExtendedArray)
- (BOOL)containsObject:(ObjectType)anObject;
參考博客:
iOS判斷數組是否包含某個元素