当我打开NSOpenPanel然后我的应用程序崩溃时,我在控制台上收到此消息:
plugin com.getdropbox.dropbox.garcon interrupted
plugin com.getdropbox.dropbox.garcon interrupted
Unable to setup extension context - error: Couldn't communicate with a helper application
Run Code Online (Sandbox Code Playgroud)
在调试器中,我在Thread 6上收到警告说:
Queue: com.apple.NSXPCConnection.user.com.getdropbox.dropbox.garcon.apple-extension-service(serial)
0_dispatch_barrier_async_f
12 start_wqthread
Enqueued from com.apple.NSXPCConnection.user.com.getdropbox.dropbox.garcon.apple-extension-service (Thread 6)
0_dispatch_barrier_async_f
Run Code Online (Sandbox Code Playgroud)
我尝试用[openPanel runModal]和打开我的NSOpenPannel[openPanel beginSheetModalForWindow:...
我只是用NSOpenPanel来打开一个txt文件
我该怎么做才能停止获取此消息并且应用程序停止崩溃?
该应用程序没有沙盒和代码签名.我只是在Debug-build中尝试,因为我没有Apple开发者帐户.Mac OS X版本为10.10,Dropbox版本为3.0.3
鉴于此模型:
public class RSS2Feed {
public var channel: RSS2FeedChannel?
public init() {}
}
public class RSS2FeedChannel {
public var title: String?
public var description: String?
public init() {}
}
Run Code Online (Sandbox Code Playgroud)
我需要做什么才能获得属性名称和值 RSS2FeedChannel实例?
这是我正在尝试的:
let feed = RSS2Feed()
feed.channel = RSS2FeedChannel()
feed.channel?.title = "The Channel Title"
let mirror = Mirror(reflecting: feed.channel)
mirror.children.first // ({Some "Some"}, {{Some "The Channel Title...
for (index, value) in mirror.children.enumerate() {
index // 0
value.label // "Some"
value.value // RSS2FeedChannel
}
Run Code Online (Sandbox Code Playgroud)
最终,我正在尝试创建一个 Dictionary使用反射与实例匹配的对象,但到目前为止我无法获取实例的属性名称和值。
文档说:
可选标签可以在适当的时候使用,例如表示存储属性的名称或活动枚举案例的名称,并将用于在将字符串传递给后代方法时进行查找。
然而我只得到一个“Some”字符串。 …
我正在使用Lumen Framework并且正在尝试从json文件中为我的数据库设置种子。我正在做这样的事情:
public function run()
{
$json = json_decode(file_get_contents('database/seed/file.json'), true);
...
}
Run Code Online (Sandbox Code Playgroud)
但是当我执行种子命令时php artisan db:seed,我收到此错误:
[错误异常]
file_get_contents(database/seed/file.json):无法打开流:没有这样的文件或目录
我试图这样做:https : //stackoverflow.com/a/34201616/3701102,我得到了这个:
[Symfony\Component\Debug\Exception\FatalThrowableError]
调用未定义的函数 public_path()
任何想法我做错了什么?
谢谢
我正在尝试用两位小数验证双精度数,但我无法实现。这是我尝试过的正则表达式和错误,我得到了:
第一次尝试:
$validation = ['price' => 'regex:[0-9]+(\.[0-9][0-9]?)?'];
Run Code Online (Sandbox Code Playgroud)
错误:
preg_match(): 未知修饰符“+”
第二次尝试:
$validation = ['price' => 'regex:[0-9]+(\.[0-9][0-9]?)?'];
Run Code Online (Sandbox Code Playgroud)
错误:
preg_match():分隔符不能是字母数字或反斜杠
第三次尝试:
$validation = ['price' => 'regex:\d+(\.\d{2})?|\.\d{2}'];
Run Code Online (Sandbox Code Playgroud)
错误:
preg_match():分隔符不能是字母数字或反斜杠
我从这个问题中得到了所有的正则表达式:Simple regular expression for a decimal with precision of 2
我究竟做错了什么?或者还有其他方法可以验证带有两位小数的双精度数Laravel吗?
我UIViewController喜欢这样的:
class ViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.dataSource = self
self.tableView.delegate = self
}
}
extension ViewController: UITableViewDataSource {
// datasource methods...
}
extension ViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
}
}
Run Code Online (Sandbox Code Playgroud)
但我得到这个警告:
实例方法'tableView(:canEditRowAt :)'几乎匹配协议'UITableViewDelegate'的可选要求'tableView(:canFocusRowAt :)'
我不能删除那个警告.
我该如何删除该警告?
我必须为我工作的公司提交Xcode项目而没有任何警告,我无法找到如何抑制警告.
我有这个功能来保存tmp文件夹中的图像
private func saveImageToTempFolder(image: UIImage, withName name: String) {
if let data = UIImageJPEGRepresentation(image, 1) {
let tempDirectoryURL = NSURL.fileURLWithPath(NSTemporaryDirectory(), isDirectory: true)
let targetURL = tempDirectoryURL.URLByAppendingPathComponent("\(name).jpg").absoluteString
print("target: \(targetURL)")
data.writeToFile(targetURL, atomically: true)
}
}
Run Code Online (Sandbox Code Playgroud)
但是,当我打开我的应用程序的临时文件夹时,它是空的.将图像保存在临时文件夹中我做错了什么?
我正在尝试property list从DataSwift 3中读取一个,但我无法实现.
我尝试过这样的事情:
let datasourceDictionary = try! PropertyListSerialization.propertyList(from: data!, options: [PropertyListSerialization.ReadOptions], format: nil) as! Dictionary
Run Code Online (Sandbox Code Playgroud)
我得到了这个错误:
无法将"PropertyListSerialization.ReadOptions.Type"类型的值(也称为"PropertyListSerialization.MutabilityOptions.Type")转换为预期的元素类型"PropertyListSerialization.MutabilityOptions"
然后我尝试了类似这样的东西,就像我以前在Swift 1.2上做的那样:
let datasourceDictionary = try! PropertyListSerialization.propertyList(from: data!, options: [PropertyListSerialization.MutabilityOptions.immutable], format: nil) as! Dictionary
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误:
'immutable'不可用:使用[]构造一个空选项集
然后我尝试了这个:
let datasourceDictionary = try! PropertyListSerialization.propertyList(from: data!, options: [], format: nil) as! Dictionary
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误:
'[Any]'不能转换为'PropertyListSerialization.ReadOptions'(又名'PropertyListSerialization.MutabilityOptions')
如何property list从"Swift 3中的数据"中读取文件或者执行此操作的方法是什么?
我正在开发我的第一个Lumen项目,我尝试seed class为我的数据库创建一个.
我正在尝试运行下一个命令:
php artisan make:seeder UsersTableSeeder
Run Code Online (Sandbox Code Playgroud)
但我总是得到这个错误:
[Symfony的\元器件\控制台\异常\ CommandNotFoundException]
命令"make:seeder"未定义.
你的意思是其中之一吗?
Run Code Online (Sandbox Code Playgroud)db:seed make:migration
我正在寻找如何解决这个问题,但我找不到任何东西.有什么想法我需要做什么?
我正在使用 lumen-framework 5.2.*
我有一个工具栏,UIBarButtomItem左边有一个标签Admin
我需要在点击它时显示一个弹出窗口,但它出现在错误的位置,它出现在屏幕的左上角:
这是打开popover的功能:
// this IBAction is assigned only to the Admin bar button item
@IBAction func openAdmin(sender: UIBarButtonItem) {
let alertController = UIAlertController(title: nil, message: "Elige una opción", preferredStyle: .ActionSheet)
// action button initializations... ... ...
let barButtonItemSize = sender.valueForKey("view")
alertController.popoverPresentationController?.sourceView = self.view
alertController.popoverPresentationController?.sourceRect = barButtonItemSize!.frame
presentViewController(alertController, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
当我触摸管理栏按钮时,我也会在控制台上收到此警告:
快照未呈现的视图会导致空快照.确保在屏幕更新后快照或快照之前至少渲染了一次视图
我究竟做错了什么?或者我需要做什么才能在管理员的顶部显示popover?
我想在 Swift 3 上将对象从一个附加NSMutablArray到另一个NSMutableArray,但我无法实现。
这是我首先尝试做的:
mutableArray.addObjects(from: anotherMutableArray)
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误:
无法转换“NSMutableArray”类型的值?到预期的参数类型 '[Any]'
然后我尝试了这个:
mutableArray.addObjects(from: anotherMutableArray as [Any])
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误:
无法转换“NSMutableArray”类型的值?强制输入“[Any]”
如何在 Swift 3 上将对象从一个附加NSMutableArray到另一个NSMutableArray?
swift ×5
ios ×3
laravel ×3
php ×3
lumen ×2
swift3 ×2
artisan ×1
dropbox ×1
lumen-5.2 ×1
nsdata ×1
nsopenpanel ×1
objective-c ×1
reflection ×1
regex ×1
swift2 ×1
uipopover ×1
uitableview ×1
xcode ×1