EMDefine.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // EMDefine.h
  3. // HyphenateSDK
  4. //
  5. // Created by dhc on 15/12/4.
  6. // Copyright © 2015年 Hyphenate.com. All rights reserved.
  7. //
  8. #ifndef EMDefine_h
  9. #define EMDefine_h
  10. #define kRegistedDeviceToken @"emRegistedDeviceToken"
  11. #define kBindDeviceToken @"emDeviceToken"
  12. #define kUuid @"emUuid"
  13. #define kUsername @"emUsername"
  14. #define kPassword @"emPassword"
  15. #define kToken @"emToken"
  16. #define kAutoLogin @"emAutoLogin"
  17. #if DEBUG
  18. #define EMRACKeyword autoreleasepool {}
  19. #else
  20. #define EMRACKeyword try {} @catch (...) {}
  21. #endif
  22. /*!
  23. @property
  24. @brief
  25. id obj1 = [[NSObject alloc] init];
  26. @EMWeakObject(obj1);
  27. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  28. @EMStrongObject(obj1);
  29. });
  30. */
  31. #define EMWeakObject(object) \
  32. EMRACKeyword \
  33. __attribute__((objc_ownership(weak))) __typeof__(object) self_weak_ = (object);
  34. #define EMStrongObject(object) \
  35. EMRACKeyword \
  36. __attribute__((objc_ownership(strong))) __typeof__(object) object = self_weak_;
  37. #endif /* EMDefine_h */