why when i Swipe the table view the swipe not disappear?
see screenshot
It just gets stuck like that and won't come back, why?
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let item = realArray[indexPath.row]
let callAction = UIContextualAction(style: .normal, title: "Call Private", handler: { (action, view, success) in
self.service.dialNumber(number: item.telephone, prefixNumber: true)
self.service.setupCallerId(firstName: item.firstName, lastName: item.lastName, telephone: item.telephone)
})
callAction.backgroundColor = .systemGreen
let configuration = UISwipeActionsConfiguration(actions: [callAction])
return configuration
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
i maked core data and i fetch all data to List.
all working (add ,delete) but! if the app inactive (to background) and i open again to delete a row it crashes with error:
"Thread 1: "An NSManagedObjectContext cannot delete objects in other contexts."
struct HistoryView: View {
@State private var history: [HistoryList] = [HistoryList]()
let coreDM: CoreDataManager
var dateFormatter: DateFormatter {
let formatter = DateFormatter()
formatter.dateFormat = "MM-dd-yyyy HH:mm"
return formatter
}
private func populateHistory(){
history = coreDM.getAllHistory()
}
var body: some View {
NavigationView{
VStack {
if !history.isEmpty {
List {
ForEach(history, id: \.self) { historyList in
HStack {
Text(dateFormatter.string(from: historyList.dateFlash ?? Date(timeIntervalSinceReferenceDate: 0)))
Text("\(historyList.timerFlash)s")
.multilineTextAlignment(.trailing)
.frame(maxWidth: .infinity, alignment: .trailing)
}
}.onDelete(perform: { indexset in
indexset.forEach { index in
let history = history[index]
coreDM.deleteHistory(history: history)
populateHistory()
}
})
}.refreshable {
populateHistory()
print("## Refresh History List")
}
} else {
Text("History Flashlight is Empty")
}
}
.onAppear {
populateHistory()
print("OnAppear")
}
}.navigationTitle("History Flashlight")
.navigationBarTitleDisplayMode(.inline)
}
}
struct HistoryView_Previews: PreviewProvider {
static var previews: some View {
HistoryView(coreDM: CoreDataManager())
}
}
why?
I have the code:
if let url = URL(string:"tel://\(String(describing: Util.checkForNullString(contactNo)))"), UIApplication.shared.canOpenURL(url){
if #available(iOS 10, *) {
UIApplication.shared.open(url)
} else {
UIApplication.shared.openURL(url)
}
}
how I can detected if user calling or dismiss?
i do this code:
struct TextView: View {
@ObservedObject var service = Service()
@State private var text: String = ""
@FocusState var isInputActive: Bool
var body: some View {
ZStack{
Color(red: 242 / 255, green: 242 / 255, blue: 247 / 255)
.edgesIgnoringSafeArea(.top)
VStack {
Text("QRCode Text")
.multilineTextAlignment(.center)
.font(.system(size: 30, weight: .heavy, design: .default))
.padding(.top, 16.0)
TextField("Enter Text", text: $text)
.textFieldStyle(RoundedBorderTextFieldStyle())
.border(Color.white)
.fixedSize(horizontal: false, vertical: true)
.multilineTextAlignment(.center)
.padding()
.frame(width: 350, height: 80)
.background(Rectangle().fill(Color.white).shadow(radius: 20))
.cornerRadius(30)
.frame(height: 100)
.focused($isInputActive)
.toolbar {
ToolbarItemGroup(placement: .keyboard) {
Spacer()
Button("Done") {
isInputActive = false
}
}
}
Image(uiImage: service.generateQRCode(from: "\(text)"))
.interpolation(.none)
.resizable()
.padding(2.0)
.scaledToFill()
.frame(width: 250, height: 250)
.fixedSize(horizontal: false, vertical: true)
.multilineTextAlignment(.center)
.frame(width: 350, height: 350)
.background(Rectangle().fill(Color.white).shadow(radius: 20))
.cornerRadius(30)
Button("Save QRCode") {
print("save")
}
.padding(.vertical, 10.0)
.padding(.horizontal, 100.0)
.background(Color.blue)
.cornerRadius(20)
.foregroundColor(Color.white)
.frame(height: 100)
Spacer()
}
}
}
}
and when i click on textfield and keyboard up, it up all view, why?
I want to use Admob in my application - an ad when opening the application only!
After many searches, some of which I did not find an answer but i found:
As of December 8, 2020, Apple has made it mandatory for developers to release what data is being collected and what it's being used for. If developers don't comply, they won't be able to publish new apps or release updates for current apps.
My questions is:
According to Apple policies, can Admob be used in the application?
and to upload the application, what data does Admob collect and what i need to mark in app store connect?
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
App Store
App Store Connect
Privacy
AdSupport
In my SwiftUI app, I have a data from an array.
While scrolling through the list, the cells are being recycled, which is great.
However, I'm puzzled because it seems that the data isn't being refetched as I scroll, which is contrary to what I expected.
I want to understand why the data isn't being refetched for recycled cells and if this is expected behavior.
class HistoryViewModel: ObservableObject {
@Published var filteredContacts: [HistoryData] = []
func updateFilteredContacts() {
filteredContacts = HistoryCallDataService().savedEntities
if self.searchText.isEmpty {
self.filteredContacts = filteredContacts
} else {
self.filteredContacts = filteredContacts.filter { contact in
contact.firstName?.localizedCaseInsensitiveContains(self.searchText) ?? false ||
contact.lastName?.localizedCaseInsensitiveContains(self.searchText) ?? false ||
contact.telephone?.localizedCaseInsensitiveContains(self.searchText) ?? false
}
}
}
The List:
List{
ForEach(vm.filteredContacts.reversed()) { item in
HStack{
VStack(alignment: .leading){
Text("\(item.firstName ?? "N/A") \(item.lastName ?? "N/A" )")
.fontWeight(.semibold)
Text("\(item.telephone ?? "N/A")")
.fontWeight(.medium)
.padding(.top,1)
}
Spacer()
VStack(alignment: .trailing){
Text("\(item.time ?? "N/A")")
.fontWeight(.medium)
Text("\(item.callHidden ? "Hidden" : "Normally ")")
.foregroundColor(item.callHidden ? Color.theme.red : Color.theme.black)
.fontWeight(.bold)
.padding(.top,1)
}
}
}
}
i attach image:
https://im.ezgif.com/tmp/ezgif-1-db6ebe2a2e.gif
[https://im.ezgif.com/tmp/ezgif-1-db6ebe2a2e.gif)
i had setup alert but alertResetSetting not showing, i do know why
but if change the positon
from:
.alert(isPresented: $showingIsResetSetting, content: alertResetSetting)
.alert(isPresented: $showingIsClearAll, content: alertClearAll)
to:
.alert(isPresented: $showingIsClearAll, content: alertClearAll)
.alert(isPresented: $showingIsResetSetting, content: alertResetSetting)
the alertResetSetting will be working but the alertClearAll not... why?
@State private var showingPrefixByCountry = false
@State private var showingIsResetSetting = false
@State private var showingIsClearAll = false
var body: some View {
VStack{
settingList
Spacer()
}
.padding(.top)
.alert(isPresented: $showingIsResetSetting, content: alertResetSetting)
.alert(isPresented: $showingIsClearAll, content: alertClearAll)
.alert("Select Your Country", isPresented: $showingPrefixByCountry) {
showingPrefixByCountryContent()
} message: { Text("Prefix")
.fontWeight(.light)
}
Section("Data") {
Button {
showingIsResetSetting.toggle()
} label: {
Spacer()
Text("Reset Setting")
.fontWeight(.semibold)
Spacer()
}
Button {
showingIsClearAll.toggle()
} label: {
Spacer()
Text("Clear All (Include history calls)")
.foregroundColor(Color.red)
.fontWeight(.bold)
Spacer()
}
}
private func alertResetSetting() -> Alert {
Alert(
title: Text("Are you sure you want to reset settings?"),
message: Text("This action will reset your settings. Without delete you history calls."),
primaryButton: .destructive(
Text("Reset"),
action: {
vm.resetSetting()
}
),
secondaryButton: .cancel(Text("Cancel"))
)
}
private func alertClearAll() -> Alert {
Alert(
title: Text("Are you sure you want to Clear All Data?"),
message: Text("This action will reset you setting and delete all history data"),
primaryButton: .destructive(
Text("Clear All"),
action: {
vm.clearAll()
}
),
secondaryButton: .cancel(Text("Cancel"))
)
}
I'm opening this post because I've encountered a perplexing issue in my application utilizing StoreKit 2 with the Sandbox environment for subscription validation.
My app makes a server call each time it opens to verify if there's an active subscription.
The problem arose after successfully making a purchase in the Sandbox. When I clear history from the Sandbox user and reopen the app, it resends a request to check the subscription, indicating that the user is still subscribed even though the purchases were deleted. Has anyone encountered a similar issue?
if I testing it with transaction manager in Xcode it working well.
`
func updatePurchasedProducts() async {
for await result in Transaction.currentEntitlements {
guard case .verified(let transaction) = result else {
continue
}
if transaction.revocationDate == nil {
self.purchasedProductIDs.insert(transaction.productID)
print("# purchased")
} else {
self.purchasedProductIDs.remove(transaction.productID)
print("# canceled")
}
}
}
Thank you very much!
I’ve been trying to contact Apple Developer Support regarding my developer account. After submitting the required documents related to the Digital Services Act (DSA), I emailed them to ask which additional documents were needed.
However, I’ve been waiting for more than 3 days now without receiving a response. Unfortunately, the only way for me to reach them is via email, as phone support is not available in my country.
This delay is causing significant issues for me, and I need to resolve this as soon as possible.
Are there any alternative methods to contact Apple Developer Support aside from email? I’d appreciate any advice or assistance.
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
Tags:
Developer Tools
App Store Connect
Developer Program
I added a feature to my app that retrieves only app settings (no personal data) from my API hosted on Cloudflare Workers. The app does not send, collect, track, or share any user data, and I do not store or process any personal information.
Technical details such as IP address, user agent, and device information may be automatically transmitted as part of the internet protocol when the request is made, but my app does not log or use them. Cloudflare may collect this information.
Question: Does this count as “data collection” for App Store Connect purposes, or can I select “No Data Collected”?
class Service: UIViewController {
static func showError(_ message:String) {
// Create new Alert
let dialogMessage = UIAlertController(title: "Error", message: message, preferredStyle: .alert)
// Create OK button with action handler
let ok = UIAlertAction(title: "OK", style: .default, handler: { (action) -> Void in
print("Ok button tapped")
})
//Add OK button to a dialog message
dialogMessage.addAction(ok)
// Present Alert to
self.present(dialogMessage , animated: true, completion: nil)
}
}
why i get error in this line:
self.present(dialogMessage , animated: true, completion: nil)
the error:
Instance member 'present' cannot be used on type 'Service'
why?
I know there is a problem with this.
But I still ask if this is possible to develop call recording in swift?
how i can convert my xcode project to ipa?
i read all the methods but it very old (all methods for xcode 9) and not working..
what i can do?
i have NavigationView in my code
i do this for button it Navigation
Button{
print("")
}label: {
Image(systemName: "list.dash")
.foregroundColor(.gray)
}
}
how i can navigate to another view when user click the button??
why the setTorchModeOn not working? it not change the level torch
guard let device = AVCaptureDevice.default(for: .video) else { return }
if device.hasTorch {
do {
try device.lockForConfiguration()
try device.setTorchModeOn(level: 0.1)
if on == true {
device.torchMode = .on
} else {
device.torchMode = .off
}
device.unlockForConfiguration()
} catch {
print("Torch could not be used")
}
} else {
print("Torch is not available")
}
}