This is the most common way to get the path to the selected instance:
xcrun xcode-select --print-path
// Excerpt from https://github.com/krzyzanowskim/CoreTextWorkshop | |
// Licence BSD-2 clause | |
// Marcin Krzyzanowski [email protected] | |
func getSizeThatFits(_ attributedString: NSAttributedString, maxWidth: CGFloat) -> CGSize { | |
let framesetter = CTFramesetterCreateWithAttributedString(attributedString) | |
let rectPath = CGRect(origin: .zero, size: CGSize(width: maxWidth, height: 50000)) | |
let ctFrame = CTFramesetterCreateFrame(framesetter, CFRange(), CGPath(rect: rectPath, transform: nil), nil) |
I recently spent a few hours helping a friend of mine investigate a weird issue in their Continuous Development infrastructure. Builds were failing with different fatal errors mostly related to SDK paths and .platform
directory locations. At first sight, it was clear that something is wrong with the current selected Xcode, but all our initial attempts to catch the problem failed.
In the end, we isolated the problem; one of the tools they use changes PATH
silently for the environment to simplify access to Xcode tools. Due to their internal logic, the CD pipeline changes a current selected Xcode a few times on the way within the same script. In some cases, the pipeline ended with xcodebuild
in the environment's PATH
that does not reflect the expected version after the xcode-select --switch
command.
How? Pretty easy, actually. A simplified sequence looked like this:
xed
is a command-line tool that launches the Xcode application and opens the given documents (xcodeproj
, xcworkspace
, etc.), or opens a new document, optionally with the contents of standard input.
If you work from the command line, this tool is a better option than open
(which can open Xcode projects as well). Why?
xed
knows about the current selected Xcode version (open
behaves unpredictably if you have multiple Xcode installed)$ uname -r
(Codecs are extracted from https://web.archive.org/web/20120722124832/http://opencv.willowgarage.com/wiki/QuickTimeCodecs )
UIImage* image = [UIImage imageNamed:@"inspiration-2.jpg"]; // image stored in app's resources | |
// stage an image | |
[FBRequestConnection startForUploadStagingResourceWithImage:image | |
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { | |
if(error) { | |
NSLog(@"Error staging resource.\n%@", error); | |
int code = [[[[[error userInfo] objectForKey:@"com.facebook.sdk:ParsedJSONResponseKey"] objectForKey:@"body"] objectForKey:@"error"] objectForKey:@"code"]; | |
if(code == 2500) { |
The diff output is more specific:
[I]f a whole block of text is moved, then all of it, rather than just the beginning and end, is detected as changed.
>The algorithm described here avoids these difficulties. It detects differences that correspond very closely to our intuitive notion of difference.