나는 한 번만 팝업해야하는 용어 계약이 있지만 앱이 시작될 때마다 팝업됩니다. 한 번만 팝업하고 한 번 누르면 팝업 할 수 없습니다. 앱을 삭제하고 다시 다운로드하지 않으면 다시 사용 가능합니다. 내가 How can I show a view on the first launch only?한 번만 표시 할 UIAlertView
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
if !UserDefaults.standard.bool(forKey: "Walkthrough") {
UserDefaults.standard.set(false, forKey: "Walkthrough")
}
}
}
class FirstViewController: UIViewController, UIAlertViewDelegate {
override func viewDidLoad() {
super.viewDidLoad()
if UserDefaults.standard.bool(forKey: "Walkthrough") {
print("already shown")
// Terms have been accepted, proceed as normal
} else {
agree()
}
}
}
기능을 동의의 나 따라 시도하고 동의하면 내가
UserDefaults.standard.set(true, forKey: "Walkthrough")
추가 정보를 추가 할 귀하의 질문에 편집 링크를 이용해주십시오. 답변 게시 버튼은 질문에 대한 완전한 대답을 위해서만 사용되어야합니다. - [검토 중] (리뷰/저품절 게시물/16202079) – dfd
무엇을 편집할까요? 완전한 대답은 내가 그것을 설정하기 위해 라인을 추가하는 것을 잊었다는 것이었다. 그것은 답이다. – user8000557