how can I add xctest framework to an old project? When I try to add a new framework I couldn't find xctest in the available list in Link Binaries With Libraries.
I also tried edit->refractor->convertToXCTEst but select targets to use xctest: lists no targets
In Xcode 6.1.1, and also in Xcode 6.0.1, the XCTest.framework is not listed anymore as an available framework. In Xcode 5.1.1, however, the framework is listed.
So something appears to have changed between Xcode 5 and 6 when it comes to testing. For instance, when you create a new project in Xcode 6 you no longer need the XCTest framework. You can simply add a new test case, build and the test runs just fine. I have yet to figure out why this is the case, but for you this might be the first thing to try: Just code a test case and see whether things work.
If they don't, then you could try this ugly workaround: Open the project with an older version of Xcode, add the framework there, then go back to work in your new version of Xcode. This worked for me when I tried it with Xcode 5.1.1.
EDIT: The reason why XCTest.framework is no longer needed in projects created by Xcode 6 is because these projects have the build setting CLANG_ENABLE_MODULES set to YES. Xcode 6 exposes this in the UI under the name "Enable Modules (C and Objective-C)". With this setting enabled, any #import statements for system frameworks such as XCTest cause clang to automatically link against that framework. Details are available in the "Modules" section of the clang documentation. Once this build setting is enabled you can also remove any other system frameworks from the "Link Binary with Libraries" build phase of your targets.
And for completeness' sake: The reason why Xcode 6 no longer lists XCTest.framework as an available framework is because the framework's location inside the Xcode bundle has changed:
# Xcode 6
/Applications/Xcode-6.1.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework
# Xcode 5
/Applications/Xcode-5.1.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/Developer/Library/Frameworks/XCTest.framework
Apparently Apple now relies entirely on CLANG_ENABLE_MODULES to get test targets to link against XCTest.framework. If you want Xcode 6 to list XCTest.framework as an available framework, you can manually create a symbolic link inside the Xcode app bundle:
cd /Applications/Xcode-6.1.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks
sudo ln -s /Applications/Xcode-6.1.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework .
You need to restart Xcode after creating the link.
Related
I want to decrease the framework deployment target from iOS 10 to iOS 9. I did the fork of the library, changed deployment target of the framework TARGET (not whole project). When I build the dependency I can see in info.plist that deployment target is iOS 9 (screenshots attached) in the framework and iOS 8 in the framework's dependency. Anyway, my project where I attach those still outputs that iOS 10 is required for this framework (yes, i did clean, delete derived data, change simulator, reset xcode).
.../MyFile.swift:13:8: Module file's minimum deployment target is ios10.0 v10.0:
.../MapFramework.framework/Modules/MapFramework.swiftmodule/arm64.swiftmodule
(that's in Swift file in the line where I have import MapFramework)
The issue was happening, because by mistake, there were two copies of the same .framework in the file hierarchy. One was in Carthage folder, another one in root folder. Even though marking in Xcode -> Reveal in Finder on the framework it always shown framework in Carthage folder, somehow it was processing both of these. After removal of the framework located in root folder everything was working perfectly fine (I didn't have to change any paths or references in Xcode, what shows that Xcode all of the time was pointing to the correct version).
Seems like an Xcode bug.
Previously to build a framework for particular platform(macOS, iOS), I used to maintain different projects in Xcode and build separately.
My code mostly depends on sqlite3.h and a wrapper class written in Swift.
Is there a way to maintain all the frameworks under one xcode project?
I searched but I didn't get any tutorials on the web.
Thank you.
yes of course xcode can handle this for a long time. you simply create your framework project and then add targets for iOS, macOS, tvOS and watchOS.
the plus sign below the target pane allows you to add more target. or just duplicate your existing target and change sdk and platform settings.
Apple simplified iOS UI testing in Xcode 7.
With new Xcode 7 projects, all you have to do to get the complete configuration for iOS UI testing is to check "Include UI tests" when creating a project.
What are the steps to get the same in Xcode 7 for projects that were created before Xcode 7 existed?
After testing several older projects:
Adding a new UI test target is sufficient as suggested by a-live in a comment to the question:
File > New > Target > Test > Cocoa Touch UI Testing Bundle
With Xcode 7 beta1, all of my projects habe been unstable after adding this target with different symptoms:
Compiler not able to import XCTest
red recording button greyed out and not working (even with cursor in the method)
Xcode crashing after pressing record button
Most problems were fixed after rebuilding the project, exiting XCode, restarting XCode with the project, rebuilding again. All were fixed after repeating this.
New UI testing framework requires your simulator running on iOS version 9.0. I encountered the issue of recording button being disabled for version below 9.0, like 8.4 etc.
The steps to add UI tests to an old project are also the same. Add a UI Testing bundle as suggested by Gerd, above. Then:
Take the cursor to a method in the .m test file.
When you take the cursor there, you will see the record button is enabled, which is on the top of the debug console.
Press record. This will start up your simulator and start writing code as per your actions.
You can find detailed steps here - https://krausefx.com/blog/run-xcode-7-ui-tests-from-the-command-line
I've created a project in Xcode 5.0 (yes, Developer Preview) for the beta iOS7 software because I wanted to play around with the new beta stuff. But I actually decided to submit the App I was playing around with to the App Store and since this is not possible with preview Xcode versions I fixed all compatibility issues to make the code work with Xcode 4.6.3 and iOS 6. Except for one thing.
And that's importing third party frameworks like Flurry (analytics framework) or Crashlytics (crash reporting framework).
Both are correctly imported and set up with targets (it's all working in Xcode 5.0) but I'm getting a 'Crashlytics/Crashlytics.h' file not found in the line I'm importing the needed classes (#import <Crashlytics/Crashlytics.h>) in Xcode 4.6.
The same is true for the Flurry framework analogously. The crazy thing is, both libraries show up in the targets 'Link Binary With Libraries' list, even in Xcode 4.6.
Does anyone have an idea how I can get things work in Xcode 4.6? Are there any further ways to influence the importing?
The link binary with libraries is not the issue here. You have to confirm your Header Search Paths in your build settings. I think Xcode 5 might use a different variable for it, and that is why Xcode 4.6 will get confused (just a guess though). Anyway, confirm that the path to those headers is in your Header Search Path. The Crashlytics app will automatically add it for you, actually.
I have an iOS app and I want to test it on simulator. When I run the project xcode complains that my framework file is "missing required architecture i386 in file".
I did a bit of search on line and it says that's because xcode used the framework files intended for actual device when building the project for simulator. Solution is to add the simulator framework folder under the framework search path in build settings.
Okay now the problem is, doing that solves the problem of building project on simulator, but later when I want to build the project on an actual device, xcode starts complaining again saying there are redefinitions of some of the openGL typedef in the framework. To fix this I have to remove the search path item that I added.
So is there an easy way to avoid having this kind of problem? I don't want to switch the search path over and over again when I want to build the project on different platform.
If you upgrade a project from 4.2 to 4.3.2 style it often loses the architectures required for the target you are building for. Usually you just have to add them back or change the target SDK.