- (int) compareCBUUID:(CBUUID *) UUID1 UUID2:(CBUUID *)UUID2 {

    char b1[128];
    char b2[128];
    [UUID1.data getBytes:b1];
    [UUID2.data getBytes:b2];
    if (memcmp(b1, b2, UUID1.data.length) == 0)return 1;
    else return 0;
}

我如何将上述方法转换为在上述方法中使用getBytes:length?

谢谢

最佳答案

为什么这么辛苦?只是:

- (int)compareCBUUID:(CBUUID *) UUID1 UUID2:(CBUUID *)UUID2 {
    return (int)(UUID1 == UUID2 || [UUID1 isEqual:UUID2]);
}

08-28 01:28