I wish there was a section in the store or a rare temporary store with all the clothes from the past events.
seen from Russia

seen from China
seen from United States

seen from China

seen from United States

seen from United States

seen from United States
seen from Philippines
seen from China
seen from United States
seen from Russia

seen from Malaysia
seen from Serbia
seen from United States

seen from United States
seen from United States

seen from United States
seen from United States

seen from United States

seen from United States
I wish there was a section in the store or a rare temporary store with all the clothes from the past events.
Retrieve Reminders stored in iOS
So this is a fairly simple thing to do, but it took me two days to figure it out. Actually would never have figured it out without the help of Google Hangouts and my partner Michael.
So, let's quickly access the Reminders stored on an iOS device. For simplicity sake, the code shared is used in a ViewController, but can be used anywhere.
So let's instance a new Event Store. To do that, we will just use lazy instantiation. I request access to the users Reminders in this manor so that the app only asks for access to the Reminders when the user reaches that point of the app. So let's put it in the event store instance property's getter method.
- (EKEventStore *)eventStore { if (!_eventStore) { _eventStore = [[EKEventStore alloc] init]; //respondsToSelector indicates iOS 6 support. if ([_eventStore respondsToSelector:@selector(requestAccessToEntityType:completion:)]) { //Request access to user Reminders [_eventStore requestAccessToEntityType:EKEntityTypeReminder completion:^(BOOL granted, NSError *error) { if (granted) { } else { } }]; } else { //iOS 5.x and lower support if Selector is not supported } [_eventStore reset]; } return _eventStore; }
Next thing we will need to do is some lazy instantiation on another instance variable, this time an NSArray of EKReminders, so that we can store the Reminders when we get access to them.
- (NSMutableArray *)remindersForTheDay { if (!_remindersForTheDay) _remindersForTheDay = [[NSMutableArray alloc] init]; return _remindersForTheDay; }
Lastly, we have to request the reminders. The tricky part here, is that you only have access to the reminders within the code block. The code block runs on a separate thread, so you can't assign a reference to them and have immediate access within your app. I will build the "findAllReminders" method the wrong way first.
- (void)findAllReminders { NSPredicate *predicate = [self.eventStore predicateForIncompleteRemindersWithDueDateStarting:nil ending:nil calendars:nil]; [self.eventStore fetchRemindersMatchingPredicate:predicate completion:^(NSArray *reminders) { self.reminderForTheDay = reminders; }]; }
So, the line "self.remindersForTheDay = reminders" will eventually assign a reference to the systems reminders, however it could happen several seconds later, which will seem like a massive amount of lag in your UI. For some apps, accessing the reminders will not affect the UI in anyway, as that process is done in the background, so this would be perfectly acceptable.
For this example though, it is assumed that the data is going to be displayed on the UI in some manor, meaning you have to access that reference immediately. So in order to do that, we have to swap the "self.remindersForTheDay = reminders;" line with something new. Objective-C has a C function that allows us to dump a block of code back onto the main thread. Using that function, we can assign a reference to the system reminders to our instance variable, and have immediate access to it, without waiting for the code block asynchronous thread to finish.
- (void)findAllReminders { NSPredicate *predicate = [self.eventStore predicateForIncompleteRemindersWithDueDateStarting:nil ending:nil calendars:nil]; [self.eventStore fetchRemindersMatchingPredicate:predicate completion:^(NSArray *reminders) { dispatch_async(dispatch_get_main_queue(), ^ { self.remindersForTheDay = reminders; }); }]; }
Using the dispatch_async(dispatch_get_main_queue(), ^{}); function, we can embed a chunk of code back onto the main thread. When that chunk of code finishes, the event store code block continues on its async thread. This allows us to instantly store a reference to the system reminders and access them on our UI, while letting the Event Store finish what ever it needs to do. It also allows you to access all of the reminders, and then perform additional work in the background on the async thread, where it won't bog down your UI.