Swift에 알림 메시지를 표시하여 iOS 애플리케이션에 의견을 표시하십시오.
코드
ViewController.swiftlet ud = NSUserDefaults.standardUserDefaults()
override func viewDidAppear(animated: Bool) {
if !ud.boolForKey("reviewed") {
let alertController = UIAlertController(
title: "おめでとうございます",
message: "クリアありがとうございました。よろしければレビューを書いて頂けませんか?今後の開発の参考に致します",
preferredStyle: .Alert)
let reviewAction = UIAlertAction(title: "レビューする", style: .Default) {
action in
let url = NSURL(string: "APP_STORE_URL")
UIApplication.sharedApplication().openURL(url!)
self.ud.setObject(true, forKey: "reviewed")
}
let yetAction = UIAlertAction(title: "まだレビューしない", style: .Default) {
action in
self.ud.setObject(false, forKey: "reviewed")
}
let neverAction = UIAlertAction(title: "今後レビューしない", style: .Cancel) {
action in
self.ud.setObject(true, forKey: "reviewed")
}
alertController.addAction(reviewAction)
alertController.addAction(yetAction)
alertController.addAction(neverAction)
presentViewController(alertController, animated: true, completion: nil)
}
}
평이한 해설
어디에나 있는 ViewController에 모두 놓으면 응용 프로그램 설명을 알리는 경보를 표시할 수 있습니다.
체크→앞으로 창 + Appstore 표시 안 함
아직 댓글이 없다→앞으로도 창이 나오지만 아무것도 하지 않으면 닫는다.
앞으로 검사하지 않음→앞으로 창구를 표시하지 않음.아무것도 안 하고 닫아.
※ ViewDid Apper가 아닙니다. ViewDid Load에 쓰면 오류가 발생합니다.
Reference
이 문제에 관하여(Swift에 알림 메시지를 표시하여 iOS 애플리케이션에 의견을 표시하십시오.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/hiso/items/dc484305fe55b15a864c
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
let ud = NSUserDefaults.standardUserDefaults()
override func viewDidAppear(animated: Bool) {
if !ud.boolForKey("reviewed") {
let alertController = UIAlertController(
title: "おめでとうございます",
message: "クリアありがとうございました。よろしければレビューを書いて頂けませんか?今後の開発の参考に致します",
preferredStyle: .Alert)
let reviewAction = UIAlertAction(title: "レビューする", style: .Default) {
action in
let url = NSURL(string: "APP_STORE_URL")
UIApplication.sharedApplication().openURL(url!)
self.ud.setObject(true, forKey: "reviewed")
}
let yetAction = UIAlertAction(title: "まだレビューしない", style: .Default) {
action in
self.ud.setObject(false, forKey: "reviewed")
}
let neverAction = UIAlertAction(title: "今後レビューしない", style: .Cancel) {
action in
self.ud.setObject(true, forKey: "reviewed")
}
alertController.addAction(reviewAction)
alertController.addAction(yetAction)
alertController.addAction(neverAction)
presentViewController(alertController, animated: true, completion: nil)
}
}
어디에나 있는 ViewController에 모두 놓으면 응용 프로그램 설명을 알리는 경보를 표시할 수 있습니다.
체크→앞으로 창 + Appstore 표시 안 함
아직 댓글이 없다→앞으로도 창이 나오지만 아무것도 하지 않으면 닫는다.
앞으로 검사하지 않음→앞으로 창구를 표시하지 않음.아무것도 안 하고 닫아.
※ ViewDid Apper가 아닙니다. ViewDid Load에 쓰면 오류가 발생합니다.
Reference
이 문제에 관하여(Swift에 알림 메시지를 표시하여 iOS 애플리케이션에 의견을 표시하십시오.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/hiso/items/dc484305fe55b15a864c텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)