Post

Replies

Boosts

Views

Activity

Document Access Codes and Settings
Currently, there must be a request for access to documents with xcode, but we do not request access. Added NSDocumentDirectoryUsageDescription to info. import SwiftUI import AVFoundation import UniformTypeIdentifiers struct ContentView: View { @State private var audioPlayer: AVAudioPlayer? @State private var isPlaying = false @State private var currentFileName: String = "No file selected" @State private var showingDocumentPicker = false @State private var songList: [String] = UserDefaults.standard.stringArray(forKey: "SavedSongs") ?? [] @State private var currentSongIndex: Int = 0 var body: some View { VStack { Text(currentFileName) .font(.headline) .padding() List { ForEach(songList, id: \.self) { song in HStack { Text(song) .onTapGesture { loadAndPlaySong(named: song) } Spacer() Button(action: { removeSong(named: song) }) { Image(systemName: "trash") .foregroundColor(.red) } } } } .listStyle(PlainListStyle()) HStack(spacing: 10) { Button(action: { showingDocumentPicker = true }) { Text("Load") .font(.system(size: 12)) .frame(width: 50, height: 25) .background(Color.blue) .foregroundColor(.white) .cornerRadius(5) } .padding(.bottom, 20) } .padding() .sheet(isPresented: $showingDocumentPicker) { DocumentPicker(audioPlayer: $audioPlayer, currentFileName: $currentFileName, songList: $songList) } .onAppear { if !songList.isEmpty { loadAndPlaySong(named: songList[currentSongIndex]) } } } func playSong() { audioPlayer?.play() isPlaying = true } func pauseSong() { audioPlayer?.pause() isPlaying = false } func stopSong() { audioPlayer?.stop() audioPlayer?.currentTime = 0 isPlaying = false } func nextSong() { currentSongIndex = (currentSongIndex + 1) % songList.count loadAndPlaySong(named: songList[currentSongIndex]) } func previousSong() { currentSongIndex = (currentSongIndex - 1 + songList.count) % songList.count loadAndPlaySong(named: songList[currentSongIndex]) } func loadAndPlaySong(named songName: String) { guard let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { return } let fileURL = documentsURL.appendingPathComponent(songName) do { audioPlayer = try AVAudioPlayer(contentsOf: fileURL) audioPlayer?.prepareToPlay() currentFileName = songName playSong() } catch { print("Error loading file: \(error.localizedDescription)") } } func removeSong(named songName: String) { songList.removeAll { $0 == songName } UserDefaults.standard.set(songList, forKey: "SavedSongs") } } struct DocumentPicker: UIViewControllerRepresentable { @Binding var audioPlayer: AVAudioPlayer? @Binding var currentFileName: String @Binding var songList: [String] func makeCoordinator() -> Coordinator { return Coordinator(self) } func makeUIViewController(context: Context) -> UIDocumentPickerViewController { let documentPicker = UIDocumentPickerViewController(forOpeningContentTypes: [UTType.audio]) documentPicker.delegate = context.coordinator return documentPicker } func updateUIViewController(_ uiViewController: UIDocumentPickerViewController, context: Context) {} class Coordinator: NSObject, UIDocumentPickerDelegate { let parent: DocumentPicker init(_ parent: DocumentPicker) { self.parent = parent } func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { guard let url = urls.first else { return } do { if url.startAccessingSecurityScopedResource() { defer { url.stopAccessingSecurityScopedResource() } let fileName = url.lastPathComponent let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! let destinationURL = documentsURL.appendingPathComponent(fileName) if FileManager.default.fileExists(atPath: destinationURL.path) { try FileManager.default.removeItem(at: destinationURL) } try FileManager.default.copyItem(at: url, to: destinationURL) parent.audioPlayer = try AVAudioPlayer(contentsOf: destinationURL) parent.audioPlayer?.prepareToPlay() parent.currentFileName = fileName if !parent.songList.contains(fileName) { parent.songList.append(fileName) UserDefaults.standard.set(parent.songList, forKey: "SavedSongs") } } else { print("I can't get file access.") } } catch { print("An error occurred while loading the file: \(error.localizedDescription)") } } func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) { } } }
0
0
443
Jun ’24
xcode
This bundle is invalid. The value for key CFBundleVersion [1.0.1] in the Info.plist file must contain a higher version than that of the previously uploaded version [5]. Please find more information about CFBundleVersion at https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion (ID: 978303b8-eb71-4d71-9169-b0b0860fd8ec) The issue is an error while uploading macOS version 1.0.1 to the App store. If I want to solve it simply and quickly now, do I have to skip 1.0.1 and upload version 5.0.1 right away? I made an inquiry to Apple, but they only asked me to ask the forum or provide technical support. I would appreciate it if you could reply even if it's not accurate. I don't know if the problem is mine or Apple's problem, so I can't solve it for a long time.
0
0
373
May ’24
Making the macOS sidebar visible again
I was coding a sidebar on macOS and folded it with my mouse, but every time I run the app, I can't see the sidebar, so I can't use the sidebar. If you add a new image once, you can't see the same, but the third window also shows the sidebar well. I don't know why It's similar when you run it on another computer at all. Current code import CoreData struct ContentView: View { @Environment(\.managedObjectContext) private var viewContext @State private var isSidebarVisible: Bool = true var body: some View { NavigationView { if isSidebarVisible { Sidebar() } MemoListView().environment(\.managedObjectContext, viewContext) } .frame(minWidth: 700, minHeight: 400) .toolbar { ToolbarItem(placement: .navigation) { Button(action: toggleSidebar) { Image(systemName: "sidebar.leading") } } } } private func toggleSidebar() { withAnimation { isSidebarVisible.toggle() } } struct Sidebar: View { @Environment(\.managedObjectContext) private var viewContext var body: some View { List { NavigationLink(destination: EasyWebListView().environment(\.managedObjectContext, viewContext)) { Label("Web Links", systemImage: "link") } NavigationLink(destination: MemoListView().environment(\.managedObjectContext, viewContext)) { Label("Memos", systemImage: "note.text") } NavigationLink(destination: ThemeListView().environment(\.managedObjectContext, viewContext)) { Label("Themes", systemImage: "photo.on.rectangle.angled") } NavigationLink(destination: AccessView().environment(\.managedObjectContext, viewContext)) { Label("Access Records", systemImage: "clock.fill") } } .navigationTitle("My App") } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView().environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) } } And the code used when there was a problem before. import CoreData struct ContentView: View { @Environment(\.managedObjectContext) private var viewContext @State private var isSidebarVisible: Bool = true var body: some View { NavigationView { Sidebar().environment(\.managedObjectContext, viewContext) MemoListView().environment(\.managedObjectContext, viewContext) } .frame(minWidth: 700, minHeight: 400) .toolbar { ToolbarItem(placement: .navigation) { Button(action: { withAnimation { isSidebarVisible.toggle() } }) { Image(systemName: "sidebar.leading") } } } } struct Sidebar: View { @Environment(\.managedObjectContext) private var viewContext var body: some View { List { NavigationLink(destination: EasyWebListView().environment(\.managedObjectContext, viewContext)) { Label("Web Links", systemImage: "link") } NavigationLink(destination: MemoListView().environment(\.managedObjectContext, viewContext)) { Label("Memos", systemImage: "note.text") } NavigationLink(destination: ThemeListView().environment(\.managedObjectContext, viewContext)) { Label("Themes", systemImage: "photo.on.rectangle.angled") } NavigationLink(destination: AccessView().environment(\.managedObjectContext, viewContext)) { Label("Access Records", systemImage: "clock.fill") } } .listStyle(SidebarListStyle()) .navigationTitle("My App") } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView().environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) } }
1
0
394
Apr ’24
One app Multi-platform. The concern of a novice developer
Hello . Currently, only the ios version is on sale on the App Store. The application is offering an icloud-linked, auto-renewable subscription. I want to sell to the app store connect with the same identifier, AppID at the same time. I simply added visionos to the existing app project to provide the visionos version early, but the existing UI-related code and the location-related code are not compatible. We used the same identifier with the same name, duplicated and optimized only what could be implemented, and created it without any problems on the actual device. However, when I added the visionos platform to the App Store cennect and tried to upload it through the archive in the app for visionos that I created as an addition, there was an error in the identifier and provisioning, so the upload was blocked. The result of looking up to solve the problem App Group -I found out about the function, but it was judged that a separate app was for an integrated service, so it was not suitable for me. Add an APP to an existing app project via target and manually adjust the platform in Xcode -> Build Phases -> Compile Soures -> Archive upload success?( I haven't been able to implement this stage of information yet.) I explained the current situation. Please give me some advice on how to implement it.visionos has a lot of constraints, so you need to take a lot of features off.
0
0
588
Mar ’24
Visionos upload error Profile doesn't include the com.apple.application-identifier entitlement.
Currently, I'm reducing the ios version being sold on the App Store with the same app id and identifier to visionos, and I'm trying to upload it using the same identifier, developer id, and icloud, but I can't upload it because of an error. I didn't know what the problem was, so I updated the update of the ios version early, but I uploaded the review without any problems. Uploading the visionos single version has a profile problem, so I would appreciate it if you could tell me the solution. In addition, a lot of the code used in the ios version is not compatible with visionos, so we have created a new project for visionos.
0
0
562
Mar ’24
Inquiry about the production of visionos apps separate from the existing ios app store sales
Hello . I'm currently selling an app. I tried to run the ios version on visionos to provide the same service as the existing app, but a huge amount of incompatible code was generated. Can I create a visionos app with the same name, add visionos from the App Store connect site, and upload a completely separate app project file? The iOS app and the visionos app will use the same icloud, in-app payment, and so on. However, we plan to separate the project itself to reduce the size of the user's app itself and optimize it.
0
0
527
Feb ’24
Connecting xcode with real my visionpro
Currently, the id of my actual visionpro device is different from the xcode that works on my macmini. I added a visionpro id to xcode, but I can't build it with my visionpro. Can I log out of the existing login to xcode and log in with the same ID as visionpro? However, the appleID created for visionpro does not have an Apple Developer membership, so there is no certificate that makes it run on the actual device. How can I add my visionpro ID from the ID with my apple developer membership to run the xcode project app on visionpro? This is the first time this is the first time.
1
0
4.7k
Feb ’24
vision pro keyboard
I think there is a problem with the keyboard of vision pro. I don't think it's difficult to enter another language. If you're not going to make it, shouldn't Apple provide an extended custom keyboard? Sometimes it's frustrating to see things that are intentionally restricted. If you have any information about vision pro's keyboard or want to discuss it, let's talk about your thoughts together! I don't have any information yet
2
0
775
Jan ’24
Vision Pro pre-order and pick-up period
For vision pro purchase, I have to move away. Assuming that I completed the pickup order through pre-order on 1.19. Do you want me to make a pre-order by choosing a pick-up date? According to what I found on the Internet, I confirmed that if you don't pick up within 3 to 5 days after the pick-up order, the pick-up order will be canceled. However, after 2.6 days due to bad weather or personal conditions. Or is it possible to pick up on the date I can pick up, such as February 12th, February 19th? Apple doesn't release information for buyers. For me Is it possible to choose a pick-up date for pre-order? Can't I cancel or extend my order even if I can't pick up for a long time due to a special situation? Is .
0
0
944
Jan ’24