Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. + (NSString*)book
  2. {
  3. __block NSString *bookName;
  4.  
  5. dispatch_async(q, ^
  6. {
  7. bookName = @"Testing";
  8. });
  9. return bookName;
  10. }
  11.  
  12. q = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, "q");
  13.  
  14. [SClass startUpBookstore];
  15. label.text = [SClass book];
  16.  
  17. dispatch_async(q, ^ //BAD_ACCESS here
  18. {
  19. bookName = @"Testing";
  20. });
  21.  
  22. + (NSString*)book
  23. {
  24. __block NSString *bookName;
  25.  
  26. dispatch_async(q, ^
  27. {
  28. bookName = @"Testing";
  29. });
  30. return bookName;
  31. }
  32.  
  33. + (void)setBook:(NSString*)name
  34. {
  35. dispatch_sync(q, ^
  36. {
  37. book = name;
  38. });
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement