iOS 10/Xcode 8 GM构建得到以下,从未在Xcode 7上使用过.任何想法?
objc [25161]:类PLBuildVersion在/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices(0x12049a910)中实现和/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices(0x1202c4210).将使用两者之一.哪一个未定义.
(注意:似乎只在模拟器中发生,不会出现在真实设备上).
我正在尝试获取从Swift中的Library导入的图像的URL以将其发送到Apple Watch,transferFile(_:metadata)但我有两个错误NSURL.
这是我的代码:
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!)
{
imagePicked.image = image
let imageUrl = editingInfo[UIImagePickerControllerReferenceURL] as! NSURL
let imageName = imageUrl.path!.lastPathComponent
let documentDirectory = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first as String!
let localPath = documentDirectory.stringByAppendingPathComponent(imageName)
let image = editingInfo[UIImagePickerControllerOriginalImage]as! UIImage
let data = UIImagePNGRepresentation(image)
data!.writeToFile(localPath, atomically: true)
let photoURL = NSURL(fileURLWithPath: localPath)
self.dismissViewControllerAnimated(true, completion: nil);
}
Run Code Online (Sandbox Code Playgroud)
我在使用*imageName和*localPath时遇到错误,因为它说:
'lastPathComponent'不可用:改为使用NSURL上的lastPathComponent.'stringByAppendingPathComponent'不可用:改为在NSURL上使用URLByAppendingPathComponent.
但我无法在Swift 2.0和Xcode 7中做到正确.我哪里出错了?
我在我正在建造的应用程序中使用一个名为temple8的内部cocoapod.这是我的Podfile:
platform :ios, '9.0'
def temple8
pod 'j2objc-temple8-debug', :configuration => ['Debug'], :path => '../temple8/build/j2objcOutputs'
pod 'j2objc-temple8-release', :configuration => ['Release'], :path => '../temple8/build/j2objcOutputs'
end
target 'cartful-ios' do
use_frameworks!
temple8
pod 'Stripe'
pod 'Alamofire', '~> 4.0'
pod 'FontAwesomeKit', :git => 'https://github.com/PrideChung/FontAwesomeKit.git'
pod 'KeychainAccess'
pod 'pop', '~> 1.0'
pod 'libPhoneNumber-iOS', '~> 0.8'
pod 'AsyncDisplayKit', :git => 'https://github.com/facebook/AsyncDisplayKit.git'
pod 'Intercom'
pod 'Mixpanel-swift'
pod 'UICountingLabel'
pod 'DTFoundation'
target 'cartful-iosTests' do
inherit! :search_paths
temple8
end
target 'cartful-iosUITests' do
inherit! :search_paths
temple8
end
end
post_install do |installer| …Run Code Online (Sandbox Code Playgroud) objective-c ×2
swift ×2
xcode ×2
cocoapods ×1
ios ×1
ios10 ×1
nsurl ×1
unit-testing ×1
xcode8 ×1