Post

Replies

Boosts

Views

Activity

save image to gallery swiftui
it want to save QRCode to galley and i get the image but why it not save?? func saveImageQRCode(from string: String) {     filter.message = Data(string.utf8)     if let outputImage = filter.outputImage {       if context.createCGImage(outputImage, from: outputImage.extent) != nil { //        let ge = UIImage(cgImage: cgimg)         let transform = CGAffineTransform(scaleX: 10, y: 10)         let scaledCIImage = outputImage.transformed(by: transform)         let uiimage = UIImage(ciImage: scaledCIImage)                 let imageData = uiimage.pngData()!         let docDir = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)         let dataNow = "\(Date.now).png"         let imageURL = docDir.appendingPathComponent(dataNow)         try! imageData.write(to: imageURL)                   _ = UIImage(contentsOfFile: imageURL.path)!         UIImageWriteToSavedPhotosAlbum(uiimage, nil, nil, nil)       }     }   }
1
0
1.1k
Dec ’22
Issue with SwiftData in Sharing Data Across SwiftUI Project and Custom Keyboard Extension
I'm currently grappling with an issue while incorporating SwiftData into my SwiftUI project, specifically when dealing with a custom keyboard extension. The challenge lies in ensuring that the data I save and import through SwiftData is effectively shared between my main project and the custom keyboard extension. Despite my efforts, it seems like the data isn't being shared as intended. I've reviewed my SwiftData implementation and the interactions between the main project and the extension but haven't been able to pinpoint the root cause. var body: some Scene { WindowGroup { TabView{ ScreenOneView() .tabItem { Label("Main", systemImage: "square.and.pencil") } Text("Setting") .tabItem { Label("Setting", systemImage: "square.and.pencil") } } } .modelContainer(for: CopiedData.self) } } SwiftDataManager: class SwiftDataManager { static let shared = SwiftDataManager() func addItem(context: ModelContext, text: String){ let item = CopiedData(text: text) context.insert(item) } func deleteItem(context: ModelContext, item: CopiedData){ context.delete(item) } } View: struct ScreenOneView: View { @Environment(\.modelContext) private var context @Query private var items: [CopiedData] List{ ForEach(items) { item in HStack{ Text("\(item.text)") Spacer() buttons } } .onDelete(perform: { indexSet in for index in indexSet { vm.delete(context: context, deleteItem: items[index]) } }) } and the code from keyboard extension: class KeyboardViewController: UIInputViewController { override func viewDidLoad() { super.viewDidLoad() setupView() } func setupView(){ let keyboardView = UIHostingController(rootView: KeyboardView().modelContainer(for: CopiedData.self)) addChild(keyboardView) view.addSubview(keyboardView.view) keyboardView.view.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ keyboardView.view.leadingAnchor.constraint(equalTo: view.leadingAnchor), keyboardView.view.trailingAnchor.constraint(equalTo: view.trailingAnchor), keyboardView.view.topAnchor.constraint(equalTo: view.topAnchor), keyboardView.view.bottomAnchor.constraint(equalTo: view.bottomAnchor) ]) keyboardView.didMove(toParent: self) } keyboardView: struct KeyboardView: View { @Environment(\.modelContext) private var context @Query private var items: [CopiedData] List{ ForEach(items) { item in contextTextCopied(text: "\(item.text)") .padding(.vertical, -6) } .onDelete(perform: { indexSet in }) .listRowBackground(Color.theme.background) } to add and delete data i use only single instance let swiftDataManager = SwiftDataManager.shared
1
0
814
Nov ’23
How to Update App Store Metadata via App Store Connect API Using Postman
I need help updating the description, keywords, what's new, and promotional text for my app on the App Store using the App Store Connect API through Postman. I already have my access token. I need to update the data for each language, I changed to PATCH, but what is the url to patch? And what json should I send?
1
0
826
Jul ’24
How to Prevent App Intents from Appearing in the Shortcuts App in SwiftUI Interactive Widgets
I'm working on a SwiftUI interactive widget using AppIntent. However, I want to prevent my AppIntents from appearing in the Shortcuts app. Currently, all my AppIntents are showing up in the Shortcuts app, but I only want them to be used within my widget. Is there a way to restrict the visibility of AppIntents so they don't appear in the Shortcuts app? Here is a simplified version of my AppIntent: import AppIntents struct MyWidgetIntent: AppIntent { static var title: LocalizedStringResource = "My Widget Intent" func perform() async throws -> some IntentResult { // Intent logic here } } I've looked into the documentation but haven't found a clear way to achieve this.
1
0
957
Aug ’24
Content Filter Permission Prompt Not Appearing in TestFlight
I added a Content Filter to my app, and when running it in Xcode (Debug/Release), I get the expected permission prompt: "Would like to filter network content (Allow / Don't Allow)". However, when I install the app via TestFlight, this prompt doesn’t appear at all, and the feature doesn’t work. Is there a special configuration required for TestFlight? Has anyone encountered this issue before? Thanks!
1
0
290
Jan ’25
Calling from Watchos
I am working with a watchOS app in SwiftUI, and I am using the following code to dial a phone number from the watch: var number = "123456789" if let telURL = URL(string: "tel:\(number)") { let wkExtension = WKExtension.shared() wkExtension.openSystemURL(telURL) } The issue is that when I try to dial a number starting with a * (asterisk) or # (hash), it doesn't work. When dialing a regular number, it works fine. Is there any way to get this to work?
1
0
117
Apr ’25
Do I need to declare data collection for simple GET requests
Hi, I have an iOS app that only makes GET requests to my own API (hosted on Cloudflare Workers). The app only receives information for its settings (like whether to show a coupon code). It does not send, collect, track, or share any user data, and I do not store or process any personal information. I understand that technical details (like IP address, user-agent, device information, etc.) are automatically sent as part of the internet protocol. Since I don’t log or use this data, I’m unsure if it counts as “data collection.” However, it is possible that Cloudflare collects this information for security purposes and deletes it after some time. Question: In this case, can I select “No data collected” in the App Privacy section of App Store Connect? Thanks!
1
0
134
Aug ’25
App Not Appearing in "Available Apps" List in Watch App
I’ve developed an Apple Watch extension for an existing iOS app. When I run the app on the watch via Xcode using the simulator, everything works fine. However, when I try to install it on my iPhone, the Watch app doesn’t show it in the "Available Apps" list, so I can't install it on the watch. The Apple Watch is connected to my iPhone, and I can see other apps available for installation without any issues. I also created a brand new project with watchOS support to troubleshoot, but the same problem occurred. Any ideas on how to resolve this?
2
0
561
Nov ’25
Issue with opening browser on Apple Watch SE 2 – black screen
Hello, I am experiencing an issue when trying to open the browser on my Apple Watch SE 2 running the latest version, watchOS 11.6. When I attempt to visit any website, the browser opens and displays the URL at the top as if it is loading, but the screen remains black and no content is displayed. The internet connection is available, and all other apps on the watch work normally. This issue occurs only with the browser. I would appreciate any guidance or solution to resolve this problem. Thank you for your assistance.
2
0
327
Aug ’25
change color background with button
i created a list with colors and i want when the user click red so all the screen was background red, if user click green so full background is green... i don't know why but the var not change..   var body: some View {           NavigationView {       List {         Section {           ScreenColorButtons(text: "Red", color: .red)           ScreenColorButtons(text: "Green", color: .green)           ScreenColorButtons(text: "Blue", color: .blue)         }       }     }   } } struct ScreenColorButtons: View {       @State static var screenSelected: Color = Color.red       var text: String   var color: Color       var body: some View{     Button(action: {       ScreenColorButtons.screenSelected = color       print(ScreenColorButtons.screenSelected)     }, label: {       NavigationLink(text){}     })   } } the ScreenColorView: struct ScreenColorView: View {   @Environment(\.presentationMode) var presentationMode       var body: some View {     Color.ScreenColorButtons.screenSelected   } } why the var not change and error to background??? thank for answer
3
0
1.7k
Nov ’22
make bool Optional core data
i have coredata and i want to add bool Optional but i get error: import CoreData @objc(HistoryData) class HistoryData: NSManagedObject {       @NSManaged var firstName: String   @NSManaged var lastName: String   @NSManaged var telephone: String   @NSManaged var time: String   @NSManaged var callHidden: Bool? // Here the error } Error: Property cannot be marked @NSManaged because its type cannot be represented in Objective-C in xcdatamodeld it selected Optional but it not do it.. why?
3
0
2.1k
Dec ’22
Array Not Updating in ViewModel Despite Subscription
I'm facing an issue in my iOS app's architecture involving CoreData, the HistoryCallDataService class, and the HistoryViewModel. I'm hoping someone can help shed light on the problem I'm encountering. Problem Description: I'm working with CoreData and have an array that I'm managing through the HistoryCallDataService class. class HistoryCallDataService { private let container: NSPersistentContainer private let containerName = "CallHistoryData" private let entityName = "HistoryData" @Published var savedEntities: [HistoryData] = [] I'm observing changes in the savedEntities property of the HistoryCallDataService class using the historyDataService.$savedEntities publisher. When the app starts, the array is updated correctly. However, if I add new content, the savedEntities array updates, but the historyArray in the HistoryViewModel does not reflect these changes. import Foundation import Combine class HistoryViewModel: ObservableObject { @Published var searchText:String = "" @Published var historyArray: [HistoryData] = [] private let historyDataService = HistoryCallDataService() private var cancellables = Set<AnyCancellable>() var selectedContact: HistoryData? = nil @Published var filteredContacts: [HistoryData] = [] init(){ addSubscribers() } func addSubscribers(){ historyDataService.$savedEntities .debounce(for: 1.0, scheduler: RunLoop.main) .sink { [weak self] (returnData) in guard let self = self else { return } self.historyArray = returnData self.updateFilteredContacts() } .store(in: &cancellables) } func updateFilteredContacts() { if searchText.isEmpty { filteredContacts = historyArray } else { filteredContacts = historyArray.filter { contact in contact.firstName?.localizedCaseInsensitiveContains(searchText) ?? false || contact.lastName?.localizedCaseInsensitiveContains(searchText) ?? false || contact.telephone?.localizedCaseInsensitiveContains(searchText) ?? false } } } The view: private var contactList: some View{ List{ ForEach(vm.filteredContacts) { 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) } } .onTapGesture { vm.selectedContact = item showingCallAlert.toggle() } .listRowBackground(vm.selectedContact?.telephone == item.telephone && showingCallAlert ? Color.theme.gray : nil) } .onDelete(perform: { indexSet in for index in indexSet { let contactToDelete = vm.filteredContacts[index] vm.delete(entity: contactToDelete) } }) } .onChange(of: vm.searchText) { _ in vm.updateFilteredContacts() } .onChange(of: scenePhase) { newPhase in if newPhase == .active { print("Active") vm.updateFilteredContacts() } } .lineLimit(1) .listStyle(.plain) } If anyone has encountered a similar situation or has insights into what might be causing this behavior, I would greatly appreciate your guidance. Thank you in advance for your help!
3
0
922
Aug ’23
Is a Read-Only GET Request Without User Data Considered ‘No Data Collection’?
Hi everyone, My iOS app performs only a GET request to an external server to receive a JSON with configuration data (e.g., app settings). It does not send any personal data — it's a read-only request used only to adjust app behavior. Since the app only performs a GET request to the server and does not send any data from the user, no data is collected or stored. In App Store Connect > App Privacy, is it correct to select: "No, we do not collect data from this app"? Just want to confirm this is acceptable before submitting. Thanks!
3
0
143
Jun ’25