ios - How to send a request to make API calls until a boolean is true -


I'm really new to the development of iOS and backend, so please, please, with the lack of technical knowledge. I apologize for the potentially misleading title, but this is my problem:

I am trying to create an iOS app that allows the user to receive push notifications when the user is selected Course conditions are open.

The method of checking whether a selected course is open or not is a GET request from my school's API, and Jason is slightly parceling response to the position of the course.

So how can I do this to get consistent requests to check the status of the selected course, and when the user sends a push notification for the Open?

It would be good if someone approaches me to some specific instructions, thanks. / P>

A push notification should come from a server from anywhere. I think what you want is a survey with local notification if you want the app to work. The downside is that the app needs to be run for the election. I recommend to know more about how it works. In order to start the voting request, you want to do something like this:

In your interface:

  @property (nonatomic, retain) NSTimer * timer;  

And in the implementation:

  - (zero) someMethod somewhere else {// Create a timer and start it automatically. Self.timer = [NSTimer scheduled timer with timer: 10.0 f / seconds seconds goal: auto selector: @sillector (checkstats) user information: zero repeats: yes]; } - (zero) checkstatus {// Request, check the status of the course if (/ * the course is open / /) {UILocalNotification * Notification = [[UILOolk Notification Alok] Init]; Notification Alertbodie = "The course is now open"; Notification FireDate = [date of NSDT]; [[UIApplication shared application] Current Local Notification Now: Notification]; // close the timer [self.timer invalid]; }}  

edit

To run it in the background, you should probably read it. The result is that you have to override the application: PerformFetchWithCompletionHandler: call the selector on your applet and from there to the checkStatus method. However, you can not control how often it will be called. This is the work of the OS and there is some degree in the user's preferences. At the end of processing, make sure to call the completed handles.

You have to set a minimum interval for fitting. In your app's app: didFinishLaunchingWithOptions: , you have to add something like this:

  - (BOOL) Application: FinishLaunchingWithOptions (UIApplication *) in the app: {[App Settlement Backfound Interface: UIPAPICINGBACKGroundFace Interfaceemannium]; Yes come back }  

And in the AppDelegate assuming the code from above is also:

  - (zero) Application: (UIApplication *) application performFetchWithCompletionHandler: (Zero (^ } (UIBackgroundFetchResult result) Full handler {completingHandler} UIBackgroundFetchResultNewData;}  

You must also set an asset to your app's informationplist file. The fetch value must be added to the key UIBackgroundModes .


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -