我正在尝试添加带纹理的圆形按钮NSToolbar.我使用Interface Builder添加NSButton到允许的工具栏项和默认项.
我正在使用window!.titleVisibility设置为的Safari样式工具栏.hidden.
Xcode 8打印此错误消息:
NSToolbarItem (<NSToolbarItem: 0x100c24000>) had to adjust the size of
<NSButton: 0x100c36690> from {43, 25} to {45, 27} as the height is expected to be
27.000000. Make sure that this toolbar item view has a valid frame/min/max size.
Run Code Online (Sandbox Code Playgroud)
这在以前的OS X版本中对我有用.
我尝试将最小和最大工具栏项高度设置为27,但Xcode会自动将最小值恢复为25.
我在类中有以下功能:
/// Returns the weather conditions at the given location.
/// - parameter for: A location on the Earth's surface.
/// - returns: If found, the `WeatherConditions` at the supplied location otherwise nil.
public func conditions(for location: Location) -> WeatherConditions? {
return nil // The actual code is not important to the question.
}
Run Code Online (Sandbox Code Playgroud)
这被称为如下let myWeather = conditions(for: myLocation).
代码工作正常,问题是关于文档.下图是该conditions功能的"快速帮助"窗口中显示的内容.假定函数的用户必须使用外部参数label(for),并且我已经明确记录了该标签,那么快速帮助窗口中的参数行是否应该读取Parameters for而不是Parameters location?
这是Xcode中的错误还是显示(内部)参数名称而不是外部参数标签的原因?
我需要将我的代码更新为swift 3.下面的代码是完美的原始解决方案,但是在XCode 8 beta和iOS 10中使用swift 3时,'userContentController'委托在我使用原始的html + js代码时没有调用打电话给本机.
class ViewController: UIViewController, WKUIDelegate, WKScriptMessageHandler, WKNavigationDelegate,UIWebViewDelegate,CLLocationManagerDelegate,URLSessionDataDelegate,UIImagePickerControllerDelegate, UINavigationControllerDelegate {
....
func initWebView(){
// JAVASCRIPT PART
let contentController = WKUserContentController();
let jScript:String = "var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width'); document.getElementsByTagName('head')[0].appendChild(meta);";
let wkUScript:WKUserScript = WKUserScript(source: jScript, injectionTime: WKUserScriptInjectionTime.atDocumentEnd, forMainFrameOnly: true);
contentController.addUserScript(wkUScript)
contentController.add(
self,
name: "refreshWebPage"
)
contentController.add(
self,
name: "forceStepBack"
)
contentController.add(
self,
name: "setPageTitle"
)
contentController.add(
self,
name: "allowBackNavigate"
)
contentController.add(
self,
name: "changeBackNavigationURL"
)
contentController.add(
self,
name: "changeLeftButtonIconVisibility"
)
contentController.add(
self, …Run Code Online (Sandbox Code Playgroud) prefetchDataSources在iOS 10 中引入的目的是什么?
我刚刚在XCode 8 GM Seed中运行了一个项目并开始出错:
MessagesExtension[17902:1238603] *** Assertion failure in -[UICollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:applyAttributes:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3599.6/UICollectionView.m:2161
Run Code Online (Sandbox Code Playgroud)
我发现XCode 8存在问题,其中.entitlements文件未针对每个方案正确引用.基本上,我的Debug .entitlements文件正在为我的Release方案引用.这导致了一个问题,因为我们实现了新的Rich推送通知逻辑,并且需要使用App组.
我使用两个不同的团队(开发和生产),因此将有两个特定的应用程序组.
有谁知道如何解决这个问题?
谢谢
entitlements ios code-signing-entitlements ios-app-group xcode8
我在iOS 10发布后将Xcode更新为版本8.Apple在代码签名过程中进行了一些更改,现在可以在目标设置的常规部分中使用.但问题是我的生产配置文件显示为不合格的配置文件.此错误消息即将到来:
"xxxproductionprovisioningprofile"不包括签名证书"iPhone Distribution:xxx(xxx)".
我再次使用相同的分发证书创建了配置文件.分发证书也存在于钥匙串中.在Xcode 7.3及更早版本中,一切都运行良好.任何帮助表示赞赏.
我有一个使用的框架
_healthStore requestAuthorizationToShareTypes:writeTypes readTypes:readTypes completion:^(BOOL success, NSError *error) {
Run Code Online (Sandbox Code Playgroud)
当我将框架包含到我的iOS应用程序中并将以下内容放入我的应用程序info.plist文件中时
<key>NSHealthShareUsageDescription</key>
<string>Read heart rate monitor data.</string>
<key>NSHealthUpdateUsageDescription</key>
<string>Share workout data with other apps.</string>
Run Code Online (Sandbox Code Playgroud)
一切正常 - 不包括那些键会导致以下错误:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSHealthShareUsageDescription must be set in the app's Info.plist in order to request read authorization.'
Run Code Online (Sandbox Code Playgroud)
我的问题是,当运行框架的单元测试时,它会因上述错误而崩溃.我把密钥放在框架和测试目标的所有info.plist文件中,但仍然会崩溃.
应该使用哪个plist文件来运行测试目标?
(还应该提到我正在切换到Swift3 - 这是Objective-C项目的一部分 - 在iOS10和XCode 8之前,这一切都运行良好).
我已经用适当的单元测试创建了一个框架来显示问题:https://github.com/asensei/HKHealthStoreFrameworkUnitTestBug
我刚安装了xcode 8.0并将我的项目升级到swift 3.我使用的是swift 2.2和xcode 7.3.1.
但是得到以下错误:
Swift不支持SDK'iPhoneSimulator9.3.sdk'
命令/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc失败,退出代码为1
我有这个应用程序,总是在iOS9上正常工作,现在我已经将swift代码迁移到3.0并添加了所需的plist行来访问照片库.
在尝试使用UIImagePickerController模拟器从相机胶卷中选择视频(通过拖动预加载)时,它总是卡在"压缩视频"上,并且不会回调委托方法.
@IBAction func videoFromLibrary(_ sender: UIBarButtonItem) {
picker.allowsEditing = false
picker.sourceType = .photoLibrary
picker.mediaTypes = UIImagePickerController.availableMediaTypes(for: .photoLibrary)!
picker.modalPresentationStyle = .popover
present(picker, animated: true, completion: nil)
picker.popoverPresentationController?.barButtonItem = sender
}
Run Code Online (Sandbox Code Playgroud)
使用真实设备它工作正常,它似乎是一个苹果bug,我想知道是否有人有这个问题或我错过了一些东西,以便UIImagePickerController在模拟器上使用视频正确再次工作(或者如果有一个解决方法).
使用Xcode 8.3 PackageApplication不见了.我确实使用它将*.app包/目录转换为*.ipa文件(重新签名后):
xcrun -sdk iphoneos PackageApplication -v "MyApp.app" -o "MyApp.ipa"
Run Code Online (Sandbox Code Playgroud)
有没有替代品,所以我可以继续将.app转换为.ipa?
xcode8 ×10
ios ×4
ios10 ×4
swift3 ×4
xcode ×4
swift ×2
entitlements ×1
macos ×1
macos-sierra ×1
objective-c ×1
wkwebview ×1