Skip to content

Instantly share code, notes, and snippets.

//
// CCHLinkLabel.h
// Stolpersteine
//
// Created by Hoefele, Claus(choefele) on 21.01.14.
// Copyright (c) 2014 Option-U Software. All rights reserved.
//
#import <UIKit/UIKit.h>
@choefele
choefele / Xcode crash
Last active August 29, 2015 14:00
Xcode crash when opening help
Process: Xcode [1860]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 5.1.1 (5085)
Build Info: IDEFrameworks-5085000000000000~10
App Item ID: 497799835
App External ID: 520942841
Code Type: X86-64 (Native)
Parent Process: launchd [251]
Responsible: Xcode [1860]
@choefele
choefele / extension
Last active August 29, 2015 14:15
How to know at run-time whether your code runs inside an iOS extension
NSDictionary *extensionInfo = [NSBundle.mainBundle objectForInfoDictionaryKey:@"NSExtension"];
NSString *extensionPointIdentifier = extensionInfo[@"NSExtensionPointIdentifier"];
if ([extensionPointIdentifier isEqualToString:@"com.apple.watchkit"]) {
NSLog(@"WatchKit extension");
} else if ([extensionPointIdentifier isEqualToString:@"com.apple.widget-extension"]) {
NSLog(@"Widget extension");
} else if (extensionPointIdentifier == nil) {
NSLog(@"iOS app");
} else {
NSLog(@"Unknown extension type");
@choefele
choefele / dispatch_after_cancellable
Created February 18, 2015 15:41
Cancellable dispatch block with delay
func dispatch_after_cancellable(when: dispatch_time_t, queue: dispatch_queue_t, block: dispatch_block_t) -> () -> Void {
var isCancelled = false
dispatch_after(when, queue) {
if !isCancelled {
block()
}
}
return { isCancelled = true }
}
@choefele
choefele / gist:aaf0edfcd2656901c08e
Created April 28, 2015 10:59
CocoaPods Podfile use_frameworks
platform :ios, '8.0'
use_frameworks!
source 'https://github.com/CocoaPods/Specs'
source '[email protected]:optionu/Specs.git'
link_with 'HereToThere Widget', 'HereToThere WatchKit Extension'
pod 'FontAwesomeKit/FontAwesome'
pod 'FontAwesomeKit/FoundationIcons'
Build target Pods-CCHBinaryData
Write auxiliary files
/bin/mkdir -p /Users/choefele/Library/Developer/Xcode/DerivedData/Test-aprwsydqlazvlbacurkmubqnhure/Build/Intermediates/ArchiveIntermediates/Test/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/Pods-CCHBinaryData.build
write-file /Users/choefele/Library/Developer/Xcode/DerivedData/Test-aprwsydqlazvlbacurkmubqnhure/Build/Intermediates/ArchiveIntermediates/Test/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/Pods-CCHBinaryData.build/module.modulemap
/bin/mkdir -p /Users/choefele/Library/Developer/Xcode/DerivedData/Test-aprwsydqlazvlbacurkmubqnhure/Build/Intermediates/ArchiveIntermediates/Test/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/Pods-CCHBinaryData.build/Objects-normal/arm64
write-file /Users/choefele/Library/Developer/Xcode/DerivedData/Test-aprwsydqlazvlbacurkmubqnhure/Build/Intermediates/ArchiveIntermediates/Test/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/Pods-CCHBinaryData.build/Objects-normal/arm64/CCHBinaryD
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@choefele
choefele / gist:99654168c75d9bd81d9d
Created May 16, 2015 21:03
handleWatchKitExtensionRequest background task
func application(application: UIApplication, handleWatchKitExtensionRequest userInfo: [NSObject : AnyObject]?, reply: (([NSObject : AnyObject]!) -> Void)!) {
let completionBlock: () -> Void = {
reply(nil)
UIApplication.sharedApplication().endBackgroundTask(self.updateCacheTask)
}
updateCacheTask = application.beginBackgroundTaskWithExpirationHandler(completionBlock)
if let userLocation = DataProviderUtils.userLocationForUserInfo(userInfo) {
DataProviderService.retrieveTripsForUserLocation(userLocation, completionBlock: completionBlock)
} else {
@choefele
choefele / Podfile
Created May 26, 2015 09:53
NSLogger – Podfile
platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs'
pod 'NSLogger'
@choefele
choefele / gist:3bbdc9b7146f69b0cb70
Last active August 29, 2015 14:21
NSLogger – startNSLogger()
private class func startNSLogger() {
let paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true);
let file = "\(paths.first!)/loggerdata"
let bundleName = NSBundle.mainBundle().objectForInfoDictionaryKey(kCFBundleNameKey as String) as! String
let logger = LoggerInit()
LoggerSetBufferFile(logger, file)
LoggerSetOptions(logger, UInt32(kLoggerOption_BufferLogsUntilConnection | kLoggerOption_BrowseBonjour | kLoggerOption_BrowseOnlyLocalDomain))
LoggerSetupBonjour(logger, nil, bundleName)
LoggerStart(nil)