Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
392 views
in Technique[技术] by (71.8m points)

objective c - Adding text field in Remote Notification, iOS 8

i want to add facility in my iOS application that user can reply to the my message directly from the push notification. Like iMessage app is doing it in iOS 8. I am able to add buttons to push notification but did not found any guide on how to add text field. Any Help Please. Thanks in advance.

------------------------------------------------------------------------------------------

I know how to add action(buttons) but how to add a text field or text view for input

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

At the time of asking, this was not possible using the provided API. UIUserNotificationAction objects only represented additional buttons you can add, but you cannot input text directly. For now, you should add a "Reply" button, and on tap, opens the app with the keyboard visible so users can reply.

With iOS 9 SDK, this is possible by setting UIUserNotificationActionBehaviorTextInput as the behavior of the notification action. Make sure to read the documentation for more information.

See this answer for an example how to achieve this in Swift.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...