Jump to content
Sign in to follow this  
Followers 0
Larry_The_Great

Please Help with simple code

2 posts in this topic

Recommended Posts

Dear InsanelyMac forum

I have been all across the internet trying to find a solution for my simple coding problem. But everywhere I go I cannot find anything of use and no one will reply to my posts. I am a novice programmer and it would be greatly appreciated if someone could spare a few moments to either give me some sample code to fix my problem or point me to somewhere else that can help me.

Heres the situation: I'm adding a simple feature in my ios xcode ios app that has a UISwitch. When the UISwitch is on an event is created (this part works fine). But when I turn the UISwitch off I cannot find a way to remove the event. Can someone please tell me what code I need to remove the event. 

 

  1. - (IBAction)switchon:(id)sender {
  2.  
  3. if (switchoutlet.on) {
  4. EKEventStore *store = [[EKEventStore alloc] init];
  5. [store requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
  6. if (!granted) { return; }
  7. EKEvent *event = [EKEvent eventWithEventStore:store];
  8. event.title = @"Event A";
  9. event.startDate = [NSDate dateWithTimeIntervalSince1970:1406948400]; //today
  10. event.endDate = [event.startDate dateByAddingTimeInterval:60*60]; //set 1 hour meeting
  11. [event setCalendar:[store defaultCalendarForNewEvents]];
  12. NSError *err = nil;
  13. [store saveEvent:event span:EKSpanThisEvent commit:YES error:&err];
  14. NSString *savedEventId = event.eventIdentifier; //this is so you can access this event later
  15. }];
  16. }
  17.  
  18. if (!switchoutlet.on) {
  19. //remove event
  20. }
  21.  
  22.  
  23. }

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Hawxxer
      Hi,
      do you know where someone could start getting involved in development for Hackintosh / IOS (jailbreaks etc.) development? I am searching for information about the Kernel development rather than developing apps. 
      I recently finished my bachelor of engineering in electric engineering but the computer science always interested me more. We are being tought about some principles of a operation systems and writing code in c..
       
       
      Until know I found the apple developer website, and the books from Jonathan Levin (but they are some kind of expensive for my current situation as a student).
      I also think that it would be useful to get started with the structure of the linux kernel.
      Do you have more sources I could learn more? How did you become what you are know in the hackintosh community? 
      Google is not very helpful "Hackintosh development" only brings up how to develop apps with an hackintosh...
       
      I posted it in AMD because I am especially interested in the kernel manipulation to get the XNU Kernel working under AMD. If this is the wrong corner, please move it in the right one. 
      Thank you.
       
      EDIT
      And for sure other sources are the wikis of insanelymac and the other hackintosh websites!
    • By Allan
      We are very close to WWDC 18, so the expeculations are very high. Look at this graphics:

      One of the big expectations for macOS is be a cross-platform system, to help developers bring their iOS apps to the Mac platform.
      Let's see...

      View full article
    • By Allan
      We are very close to WWDC 18, so the expeculations are very high. Look at this graphics:

      One of the big expectations for macOS is be a cross-platform system, to help developers bring their iOS apps to the Mac platform.
      Let's see...
    • By StealthRT
      Hey all I am wanting to create a type of REST app that would allow me to send a command to the iPad mini and have it either turn off and/or disable the home button. 

      I understand that these features would be available with 3rd party/ non-documented apis that would never pass Apples requirements. However, I am only using this app for personal use at home. 

      So has anyone done the above? Is it possible to do using iOS 11 on the iPad mini with Swift/Objective C?

      Thanks!
×