CBPeripheral+ADName.m 446 B

123456789101112131415161718192021222324
  1. //
  2. // CBPeripheral+ADName.m
  3. // Unity-iPhone
  4. //
  5. // Created by duowan123 on 2021/11/8.
  6. //
  7. #import "CBPeripheral+ADName.h"
  8. #import <objc/runtime.h>
  9. @implementation CBPeripheral (ADName)
  10. static void *strKey = &strKey;
  11. -(void)setAdvertiseName:(NSString *)advertiseName{
  12. objc_setAssociatedObject(self, &strKey, advertiseName, OBJC_ASSOCIATION_COPY);
  13. }
  14. -(NSString*)advertiseName{
  15. return objc_getAssociatedObject(self, &strKey);
  16. }
  17. @end