Build, test, and submit your app using Xcode, Apple's integrated development environment.

Xcode Documentation

Pinned Posts

Posts under Xcode tag

3,062 Posts
Sort by:
Post not yet marked as solved
0 Replies
3 Views
He terminado de desarrollar una nueva versión de mi aplicación, la cual incluye notificaciones a través de FireBase Cloud Messaging. A la hora de compilar la aplicación para probar las funcionalidades. Me sale el siguiente error: El ContentView de mi aplicación es el siguiente. import SwiftUI import WebKit import Firebase import FirebaseMessaging class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDelegate { func application (_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { FirebaseApp.configure () requestAuthorizationForPushNotification(application: application) return true } func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, witchCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { completionHandler([.banner, .sound]) } func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { completionHandler() } private func requestAuthorizationForPushNotification(application: UIApplication) { UNUserNotificationCenter.current().delegate = self UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { _, _ in } application.registerForRemoteNotifications() } func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { Messaging.messaging().apnsToken = deviceToken } struct ContentView: View { @State private var showWebView = false private let urlString: String = "https://b-p-s-o-badajoz-beta.flutterflow.app/" var body: some View { VStack(spacing: 40) { WebView(url: URL(string: urlString)!).frame(height: 890.0) .cornerRadius(10) .shadow(color: .black.opacity(0.3), radius: 20.0, x: 5, y: 5) } } struct WebView: UIViewRepresentable { var url: URL func makeUIView(context: Context) -> WKWebView { return WKWebView() } func updateUIView(_ uiView: WKWebView, context: Context) { let request = URLRequest(url: url) uiView.load(request) } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } } }
Posted
by
Post not yet marked as solved
0 Replies
3 Views
Xcode version: 15.2, iOS deployment target 15.0 When experimenting with the new Xcode 15/new linker feature "Mergable Libraries" I came across an issue with subproject framework products. I have a workspace with two projects. I want to create a group framework named GroupFramework that consists of three other frameworks. FrameworkA, FrameworkB and FrameworkC. FrameworkA and FrameworkB are in the same project as the group framework I want to create. FrameworkC is a product of another project in my workspace. GroupFramework has all three frameworks linked in the "link binary with libraries" build phase. GroupFramework has "Create merged binary" set to manual because I want to control which frameworks are linked. FrameworkA, FrameworkB and FrameworkC all have "Build mergeabe library" set to YES. The application builds in both RELEASE and DEBUG. Running in DEBUG and RELEASE When running the application on a device in DEBUG or RELEASE it crashes with a linker error because FrameworkC can't be found on disk. When inspecting the app binary in RELEASE I can see that FrameworkA and FrameworkB are both in the ReexportedBinary folder, but FrameworkC is nowhere to be seen. I have tried embedding FrameworkC explicitly in the settings of the GroupFramework essentially creating an umbrella framework, and that also does not fix the issue. I have also tried embedding FrameworkC directly into the AppTarget that will consume GroupFramework. This solves the linking issue but a new issue regarding unresolved symbols then crops up. It appears as though the Reexporting and Merging of subproject frameworks is not working compared to a product that exists in the same project or at least may require a lot more manual configuration which is not currently documented anywhere. If this is the case, it could be very problematic when trying to adopt mergeable libraries in multi-project workspaces.
Posted
by
Post not yet marked as solved
0 Replies
99 Views
I just bought a Vision Pro to build and run my app on it, but I'm encountering this error from Xcode: Developer Mode is enabled. Computer is paired. Device is paired, and it's connected to my Mac via the Developer Strap. In the "VPN & Device Management" setting it says to navigate to, there is no "Developer App certificate". Others have suggested clearing the ModuleCache in DerivedData, but that's also been fruitless. I've cleaned the build multiple times, and restarted both devices, and Xcode. I have no idea what else I can possibly do to resolve this. Does anyone have any other ideas?
Posted
by
Post not yet marked as solved
0 Replies
52 Views
Running Sonoma 14.4.1 and XCode 15.3 I'm unable to verify an app update. This app runs fine under Sonoma and the project has been verified many times before for earlier systems, but the new XCode crashes every time during the verification step. Of course this is stopping any further app updates. Is this known to anyone else? I've submitted the crash reports.
Post not yet marked as solved
0 Replies
150 Views
Some Macs recently received a macOS system update which disabled the simulator runtimes used by Xcode 15, including the simulators for iOS, tvOS, watchOS, and visionOS. If your Mac received this update, you will receive the following error message and will be unable to use the simulator: The com.apple.CoreSimulator.SimRuntime.iOS-17-2 simulator runtime is not available. Domain: com.apple.CoreSimulator.SimError Code: 401 Failure Reason: runtime profile not found using "System" match policy Recovery Suggestion: Download the com.apple.CoreSimulator.SimRuntime.iOS-17-2 simulator runtime from the Xcode To resume using the simulator, please reboot your Mac. After rebooting, check Xcode Preferences → Platforms to ensure that the simulator runtime you would like to use is still installed. If it is missing, use the Get button to download it again. The Xcode 15.3 Release Notes are also updated with this information.
Posted
by
Post not yet marked as solved
1 Replies
46 Views
I get warnings from Visual Studio saying that in order to run cross platform MAUI applications I need to reduce the xCode version to 14.3. The emulator appears but the app can't be interacted with, using the latest versions of both VS and XC. So I've decided to try downloading the earlier version of xCode, but there seem to be no active Apple sponsored links and I'm wary of trying an alternate website. All links suggest https://developer.apple.com/downloads/ but this redirects to https://developer.apple.com/account From the account page there is a download https://developer.apple.com/download/ but this only holds OS operating systems. The xCode page: https://developer.apple.com/xcode/ only has 15 available. https://developer.apple.com/xcode/resources/ which says it has a download for earlier versions of software, only points me back to the account page and we're back to square one. So someone please let me know if I'm insane or the 14 is too deprecated to download and VS is no longer compatible.
Posted
by
Post not yet marked as solved
3 Replies
97 Views
There is some new UI in Xcode for upgrading OS versions. I clicked the new Get button at the top of the screen. It went and got the new iOS 17.4. Great, but it is just sitting there. After much floundering around, I eventually found the UI that has the Install button. Clicked it. Nothing happens. I have restarted Xcode several times, went looking for an Xcode update, no joy. My development is now dead for two days. Really not happy.
Posted
by
Post not yet marked as solved
0 Replies
35 Views
I'm seeing some weird behavior with conditional compilation when I use a build configuration other than "Debug" or "Release", and I'm wondering if I'm doing something wrong or if this is an Xcode bug. The setup Xcode version: 15.3 I have a simple SwiftUI view that takes in a model and displays an attribute of the model. struct ContentView: View { let model: Model var body: some View { VStack { Text("Name: \(model.name)") } .padding() } } In the model file, I have the struct definition, but also an extension that defines some sample data for use in SwiftUI previews: struct Model { let id: String let name: String } #if DEBUG extension Model { static let example = Model( id: "50fef362-f53d-4ded-9168-b887ff62e59d", name: "John Doe" ) } #endif And finally, I have a preview provider that uses this sample data: #Preview { ContentView(model: Model.example) } Normal behavior With the default "Debug" build configuration, this works just fine. There are no compilation errors, and the preview renders as expected. The issue Start off by changing the name of the build configuration to, e.g. "DebugDev" Now I start seeing seeing a mis-match between what happens and what Xcode tells me is happening. The code still compiles and runs, and the SwiftUI preview still works, but Xcode is displaying things as if it doesn't compile. Xcode formats the conditionally compiled code with a lower opacity color as if DEBUG isn't defined: In the view file, I now see a compilation error when referencing the conditionally-compiled code: Autocomplete doesn't work when trying to reference the conditionally compiled code Additional details/observations I have confirmed that the DEBUG active compilation condition is still defined in the build settings. All I've done is change the name of the build config I was initially thinking this might have something to do with the fact that this appears in a preview provider, since those are treated a bit differently, but the same thing happens if I reference the conditionally compiled code directly in the view class Another theory: since I was referencing conditionally compiled code from code that wasn't conditionally compiled, maybe Xcode was trying to tell me that wasn't valid. So, I tried placing the code that calls the conditionally compiled code (in this case, the view class) inside an #if DEBUG. This does get rid of the displayed compilation error, but auto-complete still doesn't work, and the whole class is displayed with the lower-opacity font. Help? I feel like I must be missing something. The only alternative I can think of is that Xcode has some logic hard-coded with the default "Debug" build config, and that would be...just silly.
Posted
by
Post not yet marked as solved
0 Replies
63 Views
I'm trying to download artifacts from some recent Xcode Cloud builds. In both Xcode and App Store Connect I'm getting errors. Xcode says: "Error Fetching Test Results: API Invalid status code: 501. App Store Connect says: "artifacts could not be found." FB13773789 - Xcode Cloud: Service returning 501 in Xcode when trying to view artifacts of successful build from minutes ago I have tried several projects to rule out project specific issues and it is happening to all of my Xcode Cloud enabled projects. Both Xcode 15.3 and 15.4 beta exhibit this behavior. Is anyone else running into this issue? I noticed it yesterday, and it continues into this morning.
Posted
by
Post not yet marked as solved
0 Replies
72 Views
Hello, I've got a "other swift flag" set up for one of my schemes. It works when I build locally, but not when I try building using Xcode Cloud. My Other Swift Flags is set up like this: My code looks something like this: class Config { #if LIMITED static let configProperty = 1 #endif } However, Xcode Cloud says Config has no member 'configProperty', when I build my 'Limited' scheme.
Posted
by
Post not yet marked as solved
0 Replies
80 Views
Any ideas on this would be greatly appreciated. Is it a process error, set-up error or should I be raising a ticket for this? I continue to have 2 error messages when attempting push/pull to remote repository. Example: Create new project on Desktop using Xcode, File/New Project (tick 'create Git repository on my Mac'). Change 'ContentView' text to “Hello world!2”. Integrate/Commit, stage all, amend, commit. Create new remote repository (I have checked GitHub and a new repository has been added). Change 'ContentView' text to “Hello world!3” Integrate/Commit, stage all, amend, commit. - all looks fine so far Integrate/push to origin/main: Error message: “The local repository is out of date, make sure all changes have been pulled from the remote repository and try again”. There is now 1 up and 1 down arrow next to the branch. Integrate/pull Error message: "An unknown error has occurred. No merge base found". I have tried this several times with same response, using iMac with Xcode 15.3, also tried with Xcode 15.2.
Posted
by
Post marked as solved
4 Replies
99 Views
In a feat of unmitigated disk cleaning, I removed who-knows-what, likely from ~/Library/Developer. Now I can't build apps that rely on watchOS (or likely tvOS/visionOS from the look of things). Run a try to build, Xcode tells me I should download watchOS, immediately shows me that it has, then does nothing. My Platforms window looks like this. If I tap Get next to watchOS 10.2 it looks like it succeeds immediately, but doesn't work (notice that 10.2 is already in the list). If I try to delete 10.2 from this list, it gives me an error that it can't find it on disk to delete it. I'm guessing there's a mismatch between some preference file and reality. Totally my fault I'm certain. Best way to recover?
Posted
by
Post not yet marked as solved
0 Replies
68 Views
I am using XCode on my Mac Book Pro M1 and trying to run the iOS app being developed on my iPad (5th generation, 12.9 inch) The devices are connected through USB-C cable. I have enabled developer mode on my iPad, trusted the M1 device, the developer, and the app. However the following appears on the iPad when trying to launch the app: Unable to Verify App An internet connection is required to verify trust of developer "Apple Development: ...". This app will not be available until verified This seems to be an issue with M1 specifically, as other people seem to have this problem, and the application successfully runs on other iOS devices
Posted
by
Post marked as Apple Recommended
582 Views
Hi all. I have a problem related to Xcode. Xcode says "iOS 17.2 simulator" is not installed, but I have been using this simulator for a long time and have installed the necessary SDKs. The problem has also been occurring for my colleagues since May 1, 2024. Restarting the Mac helps (there is no problem in Xcode after restarting Mac), but after reopening Xcode this problem repeats again. macOS 14.3.1 (23D60) Xcode 15.2 (15C500b)
Posted
by
Post marked as Apple Recommended
685 Views
During last night, Apple allegedly pushed new XProtect antivirus signatures. After that, I think XProtect found the malware Pirrit in my Xcode Simulator files from Apple. I'm not kidding. This is an excerpt from the XProtect log (notice the NSFilePath!): 2024-05-01 07:54:12.951 Pirrit 👉 no status_message report time 0.0000000 {"action":"report","path":{"modificationDate":732892166.8634809,"path":"\/Library\/Developer\/CoreSimulator\/Images\/1944D6AF-4D6B-4877-8F87-924EB62FC984.dmg","creationDate":732892166.8634809},"status":{"description":"Error deleting path: \/Library\/Developer\/CoreSimulator\/Images\/1944D6AF-4D6B-4877-8F87-924EB62FC984.dmg: Error Domain=NSCocoaErrorDomain Code=513 \"“1944D6AF-4D6B-4877-8F87-924EB62FC984.dmg” couldn’t be removed because you don’t have permission to access it.\" UserInfo={NSUserStringVariant=(\n Remove\n), NSFilePath=\/Library\/Developer\/CoreSimulator\/Images\/1944D6AF-4D6B-4877-8F87-924EB62FC984.dmg, NSUnderlyingError=0x1247612a0 {Error Domain=NSPOSIXErrorDomain Code=1 \"Operation not permitted\"}}.","causedBy":[],"code":24}} 2024-05-01 07:54:13.197 Pirrit message not in JSON format 2024-05-01 07:54:41.125 Pirrit ⚠️ FailedToRemediate time 0.0000280 {"caused_by":[],"execution_duration":2.8014183044433594e-05,"status_code":24,"status_message":"FailedToRemediate"} XProtect also detects another threat on my machine: 2024-05-01 10:09:58.530 BadGacha ⚠️ ThreatDetected time 0.0000120 {"caused_by":[],"execution_duration":1.2040138244628906e-05,"status_message":"ThreatDetected","status_code":21} Please check your XProtect logs. There is an app that can display these logs out there. Or you can use the system logging facility. I have deleted the whole Developer folders (both at / and ~) and reinstalled Xcode (not Beta). But a new XProtect scan finds Pirrit in the Core Simulator file again! I have also attempted to install an anti virus solution (Malwarebytes), but it does not detect anything. I am wondering if we should get someone from Apple involved. I am also wondering if I should reset my whole machine… Is anyone else seeing these issues in the XProtect log? It is unclear at this time whether there really is a Pirrit malware in Apple's Xcode simulator files or if there is some issue with XProtect like a faulty signature. Don't panic.
Posted
by
Post not yet marked as solved
1 Replies
121 Views
Hi everyone, I'm encountering an issue with my iOS device not connecting to Xcode after updating to iOS 17.4. Even after trying various troubleshooting steps, including downloading Xcode 15.4 Beta, the problem persists. Troubleshooting Steps Taken: Restarted my Mac. Untrusted and re-trusted the iOS device. Restarted the iOS device. Ran the command defaults write com.apple.dt.Xcode DVTEnableCoreDevice enabled in Terminal and restarted Xcode. Additional Information: I've checked for any available updates for both Xcode and my iOS device, but none are available. There haven't been any recent changes or updates to my development environment prior to encountering this issue. My iOS device version is 17.4, and my MacOS version is Sonoma 14.4.1. Error Messages: There are no specific error messages displayed. The devices simply do not recognize each other when attempting to connect via Xcode. I would greatly appreciate any assistance or suggestions on how to resolve this issue. Thank you in advance for your help!
Posted
by
Post not yet marked as solved
2 Replies
108 Views
So like the title says, when I start up Xcode the preview won;t work till I run a debug session using the simulator. Sometimes the debug session is unable to start the simulator, which I can start manually then run a debug session. Once all the above is done, preview works. Any idea what is causing this behavior?
Posted
by
Post not yet marked as solved
1 Replies
198 Views
Simulators will not install. Run destinations all empty. Can't even run on device. XCode 15.4 beta Sonoma 14.4.1 Intel Mac 16" MBP Attached screenshot of error. iOS 17.5 beta 2 (21F5058d) "Not compatible with XCode 15.4 beta" No run destinations appear. Not even 17.4 device that is plugged in. This all worked yesterday after initial XCode upgrade to 15.4 beta. Now all destinations are missing, even though they appear as installed in the 'Platforms' window. (yes I have rebooted and restarted XCode).
Posted
by