Notes
Notes - notes.io |
0) Mağaza & RC hazırlığı (panel)
App Store’da In-App Purchase ürün(ler)ini oluştur (örn. com.yourapp.premium.monthly).
RevenueCat panelinde App → Entitlements: premium_access oluştur.
Offerings → default offering içinde Package (monthly) ve Product eşlemesini yap (App Store’daki product id ile birebir aynı).
RC Public SDK Key (iOS)’ini not et.
1) SDK kurulumu (SPM)
Xcode → File > Add Packages…
URL: https://github.com/RevenueCat/purchases-ios
Add to App Target.
2) Uygulama başlatma (AppDelegate/SceneDelegate veya SwiftUI App)
App başlarken Purchases’ı konfigüre et. observerMode genelde false bırakılır (RevenueCat satın almayı yönetir).
SwiftUI (App giriş noktası)
import SwiftUI
import RevenueCat
@main
struct YourApp: App {
init() {
let config = PurchasesConfiguration(withAPIKey: "RC_IOS_PUBLIC_SDK_KEY")
config.observerMode = false
Purchases.configure(with: config)
Purchases.shared.delegate = PurchasesDelegateProxy.shared
}
var body: some Scene { WindowGroup { ContentView() } }
}
UIKit (AppDelegate)
import UIKit
import RevenueCat
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let config = PurchasesConfiguration(withAPIKey: "RC_IOS_PUBLIC_SDK_KEY")
config.observerMode = false
Purchases.configure(with: config)
Purchases.shared.delegate = PurchasesDelegateProxy.shared
return true
}
}
Purchases delegate (abonelik durumu değişince yakalamak için):
final class PurchasesDelegateProxy: NSObject, PurchasesDelegate {
static let shared = PurchasesDelegateProxy()
func purchases(_ purchases: Purchases, receivedUpdated customerInfo: CustomerInfo) {
let hasPremium = customerInfo.entitlements.active["premium_access"] != nil
// Burada UI/State güncelle: premium özellikleri aç/kapat
NotificationCenter.default.post(name: .premiumStatusChanged, object: hasPremium)
}
}
extension Notification.Name { static let premiumStatusChanged = Notification.Name("premiumStatusChanged") }
3) Paywall: paketleri çek, satın al, entitlement kontrol et
SwiftUI Paywall örneği
import SwiftUI
import RevenueCat
struct PaywallView: View {
@State private var isLoading = false
@State private var packages: [Package] = []
@State private var isPremium = false
@State private var errorText: String?
var body: some View {
VStack(spacing: 16) {
Text(isPremium ? "Premium aktif" : "Premium değil").font(.headline)
if isLoading { ProgressView() }
ForEach(packages, id: .identifier) { pkg in
Button(action: { purchase(pkg) }) {
Text("Satın al: (pkg.storeProduct.localizedTitle) – (pkg.storeProduct.localizedPriceString)")
}
.buttonStyle(.borderedProminent)
}
Button("Satın alımları geri yükle", action: restore)
if let err = errorText {
Text(err).foregroundColor(.red).font(.caption)
}
}
.padding()
.onAppear {
Task { await refreshStatus(); await loadPackages() }
}
.onReceive(NotificationCenter.default.publisher(for: .premiumStatusChanged)) { note in
if let val = note.object as? Bool { isPremium = val }
}
}
private func refreshStatus() async {
do {
let info = try await Purchases.shared.customerInfo()
isPremium = info.entitlements.active["premium_access"] != nil
} catch { errorText = error.localizedDescription }
}
private func loadPackages() async {
isLoading = true
defer { isLoading = false }
do {
let offerings = try await Purchases.shared.offerings()
if let current = offerings.current {
packages = current.availablePackages
}
} catch { errorText = error.localizedDescription }
}
private func purchase(_ pkg: Package) {
Task {
do {
let info = try await Purchases.shared.purchase(package: pkg)
isPremium = info.customerInfo.entitlements.active["premium_access"] != nil
} catch {
// Kullanıcı iptali vs. burada düşer:
errorText = (error as NSError).localizedDescription
}
}
}
private func restore() {
Task {
do {
let info = try await Purchases.shared.restorePurchases()
isPremium = info.entitlements.active["premium_access"] != nil
} catch { errorText = error.localizedDescription }
}
}
}
UIKit (minimal) – Paket çekme & satın alma
import UIKit
import RevenueCat
final class PaywallViewController: UIViewController {
private var packages: [Package] = []
override func viewDidLoad() {
super.viewDidLoad()
Task { await load() }
}
private func load() async {
do {
let offerings = try await Purchases.shared.offerings()
packages = offerings.current?.availablePackages ?? []
// tableView.reloadData()
} catch {
// hata göster
}
}
func buy(package: Package) {
Task {
do {
let result = try await Purchases.shared.purchase(package: package)
let hasPro = result.customerInfo.entitlements.active["premium_access"] != nil
// UI güncelle
} catch {
// userCancelled vs.
}
}
}
func restore() {
Task {
do {
let info = try await Purchases.shared.restorePurchases()
let hasPro = info.entitlements.active["premium_access"] != nil
// UI güncelle
} catch { /* hata */ }
}
}
}
4) Oturum yönetimi (çoklu cihaz senkron)
// Kullanıcı giriş yaptıktan sonra:
try await Purchases.shared.logIn("USER_123")
// Çıkış:
try await Purchases.shared.logOut()
5) İnce ayarlar (opsiyonel ama faydalı)
Intro/Trial uygunluğu
let products = try await Purchases.shared.products(["com.yourapp.premium.monthly"])
if let p = products.first {
let hasIntro = p.introductoryDiscount != nil
}
Abonelik yönetim ekranına yönlendir (ayarlar sayfasına buton koymak iyi olur):
Apple’ın abonelik yönetim linki: https://apps.apple.com/account/subscriptions
Fiyat yerelleştirme: pkg.storeProduct.localizedPriceString
A/B teklifleri: RC’de birden fazla Offering oluştur, uzaktan değiştir.
6) Test & Yayın
StoreKit Test (lokal): Xcode’da StoreKit Configuration ekleyip sahte aboneliklerle akışı dene.
Sandbox: App Store Connect → Users and Access → Sandbox Testers.
Sandbox’ta süreler hızlandırılmıştır (yenileme/iptal hızlı olur).
Review uyumu: Paywall’da Gizlilik Politikası ve Kullanım Şartları linkleri bulunsun.
7) En sık hatalar & hızlı kontrol listesi
App Store product ID 🔁 RC Product ID birebir aynı.
premium_access entitlement’ı aktif olduğunda yalnızca bundan kontrol ediyorsun.
observerMode = false.
Purchases.shared.delegate set edildi.
Restore, Login/Logout test edildi.
Sandbox tester ile gerçek satın alma akışı denendi.
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team
