How to implement a running clock in iOS? - ios

I am trying to make a simple app whereby a user selects a date/time in future and upon that date/time happening that a particular event happens.
How do I get about getting such a thing implemented?
Thanks

You want UILocalNotification.

Are you talking about getting Notification such as Alarm??
If yes, Local Notification is the same that you want. For using it please go through demo explanation : http://www.iostipsandtricks.com/ios-local-notifications-tutorial/
and for API's see YusufX's answer...

Related

UILocalNotification in Swift

My app uses UILocalNotification. On some action from a user, say press of a button, I need to cancel ALL UILocalNotifications, which were set by my application. I have found a solution, however this didn't work out in all cases. The solution was like this:
let scheduledNotifications = UIApplication.shared.scheduledLocalNotifications
scheduledNotifications?.forEach {
UIApplication.shared.cancelLocalNotification($0)
}
Trying to fix the bug (one or several notifications were not cancelled), I've found a shorter solution, which was simply this:
UIApplication.shared.cancelAllLocalNotifications()
The latter one seems to work just fine.
What don't I understand? Is there really some difference in functionality of these two snippets of code?
Accompanying question:
1) Specifically, notification set by another version of the app was not cancelled by the first solution.
2) What is happening on rolling out a new version of app? I mean, what about UserDefaults and LocalNotifications set by previous version of the app? Are these kept between different version of the app? What happens with the app on update from App Store?
Any help is appreciated. Thank you!

Adding actions to UILocalNotification in iOS 10

I have an app that sends push notifications to the user.
I want to add to every notification 2 buttons (actions), I think it's called Rich Notifications.
I didn't find enough information on how to do it, so I would really appreciate if someone could guide me here.
Thanks!
You need to add a notification category and the category will have notification actions. Those actions will define what the buttons say and what gets passed to your app when the user chooses one.
Googling the keyword you provide return many results. Why don't you pick one and try it out for yourself. One of it can be found on this link
http://willowtreeapps.com/blog/wwdc-2016-rich-notifications-in-ios-10/

How to store my app each interaction in database in IOS?

I want to push my app each activity into server.
If any button is pressed, it should be save as user pressed that
button.
If any alert came also, it should save the activity.
When any error came inside the app, we should be able to save.
This question is raised because, if user struck on any activity I want to track how the user is using the app step by step.
Can any one please help me to reach the need.
Sounds like you want something like Flurry? They are now owned by Yahoo but you can probably find some competitors that provide what you need. Or, use Yahoo's stuff.
You can use some open source library. XCGLogger is your friend.
Allows you to log details to the console (and optionally a file), just like you would have with NSLog or println, but with additional information, such as the date, function name, filename and line number.
You can use Google Analytics it is free and easy to implement.
Here is iOS document: Document & Guides

Can we get wrist raised event for apple watch?

We have started with apple watch and gone through many documents and links.
We want to build some use cases when user raises his/her wrist when using apple watch.
Even if going through many documents and links still below question is uncleared.
Is it possible to get any event in objective c when user raises his/her wrist?
Please advise if my question is not clear here.
Thanks in advance.
No, with current API it's not possible.
However Watch/WatchKit somehow can distinguish this gesture, short-look/long-look notification mechanism is based on that.

iOS schedule and notifications

I want to make an iOS app that checks a database every day on 10:00 AM. And if there is a new post, send a push notification, like whatsapp and facebook. I searched on Google for this but did not find anything that could help me.
Can anyone give me some information or a good tutorial about this?
Your approach is wrong. This should all be controlled by a server. The server should run a job at the designated time each day which checks for (unread) content and sends a push notification. The app is just there to receive the push notification and display the results.
You need to learn about Local & Push Notifications. Yes, Apple documentation is very rich.
This is a cool short video on how to implement it in Xcode 5.
AppCoda also has a blog post on it.

Resources