当我尝试在设备上工作时,我收到了这个错误.但是应用程序在Simulator中工作得很好.我该怎么办?你有什么建议吗?
dyld`dyld_fatal_error
Run Code Online (Sandbox Code Playgroud)
谢谢
我只想通过电话号码联系姓名和姓氏.我试过这个,但这太慢了,cpu超过%120.
let contactStore = CNContactStore()
let keys = [CNContactGivenNameKey, CNContactFamilyNameKey, CNContactPhoneNumbersKey]
var contacts = [CNContact]()
do {
try contactStore.enumerateContactsWithFetchRequest(CNContactFetchRequest.init(keysToFetch: keys), usingBlock: { (contact, cursor) in
if (!contact.phoneNumbers.isEmpty) {
for phoneNumber in contact.phoneNumbers {
if let phoneNumberStruct = phoneNumber.value as? CNPhoneNumber {
do {
let libPhone = try util.parseWithPhoneCarrierRegion(phoneNumberStruct.stringValue)
let phoneToCompare = try util.getNationalSignificantNumber(libPhone)
if formattedPhone == phoneToCompare {
contacts.append(contact)
}
}catch {
print(error)
}
}
}
}
})
if contacts.count > 0 {
contactName = (contacts.first?.givenName)! + " " + …Run Code Online (Sandbox Code Playgroud) 我试图在鼠标移动时获得x,y坐标.当我想要得到它时,我会收到错误.
TypeError:无法在HTMLDivElement.onmousemove(仪表板:442)的mouseMove(仪表板:593)处读取undefined属性'latlng'
<div id="map" onmousemove="mouseMove()"></div>
<script type="text/javascript">
var iMaxZoom = 1;
var map = L.map('map', {
crs: L.CRS.Simple,
minZoom: -5,
maxZoom: 1
});
var bounds = [[0,0], [711,473]];
var image = L.imageOverlay('{!! asset('assets/images/birlikmarket.png') !!}', bounds).addTo(map);
map.fitBounds(bounds);
// mouse move detect x, y coordinates
function mouseMove(e) {
var tileSize = [711,473]
try {
console.log(e.latlng)
}catch(error) {
console.log(error)
}
}
</script>
Run Code Online (Sandbox Code Playgroud) 我试图这样做,但它说
"AnyObject"类型的值?没有会员'发电机'
所以这是我的代码.
let dataDictionary:NSDictionary = try NSJSONSerialization.JSONObjectWithData(responseObject as! NSData, options: NSJSONReadingOptions.MutableContainers) as! NSDictionary
var customerArray = dataDictionary.valueForKey("kart")
for js: NSDictionary in customerArray {
let nameArray: NSArray = js.valueForKey("name")
}
Run Code Online (Sandbox Code Playgroud)
我做错了什么.我没弄明白.谢谢你的帮助.
我想按顺序更改每个单元格背景颜色.
这是我的颜色.我只想在图像中显示它们.
我现在用随机颜色显示它.但我想按顺序显示它们.
var cellColors = ["F28044","F0A761","FEC362","F0BB4C","E3CB92","FEA375"]
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! GroupTableViewCell
let randomColor = Int(arc4random_uniform(UInt32(self.cellColors.count)))
cell.contentView.backgroundColor = UIColor(hexString: self.cellColors[randomColor])
}
Run Code Online (Sandbox Code Playgroud)
我只需要了解如何检测scrapy是否已保存以及蜘蛛中的项目?我正在从网站上获取项目,之后我正在获取该项目的评论.所以首先我必须保存项目,之后我会保存评论.但是当我在编写代码之后编写代码时,它会给我这个错误.
save() prohibited to prevent data loss due to unsaved related object ''.
这是我的代码
def parseProductComments(self, response):
name = response.css('h1.product-name::text').extract_first()
price = response.css('span[id=offering-price] > span::text').extract_first()
node = response.xpath("//script[contains(text(),'var utagData = ')]/text()")
data = node.re('= (\{.+\})')[0] #data = xpath.re(" = (\{.+\})")
data = json.loads(data)
barcode = data['product_barcode']
objectImages = []
for imageThumDiv in response.css('div[id=productThumbnailsCarousel]'):
images = imageThumDiv.xpath('img/@data-src').extract()
for image in images:
imageQuality = image.replace('/80/', '/500/')
objectImages.append(imageQuality)
company = Company.objects.get(pk=3)
comments = []
item = ProductItem(name=name, price=price, barcode=barcode, file_urls=objectImages, product_url=response.url,product_company=company, comments = …Run Code Online (Sandbox Code Playgroud) 我正试图在avplayer中播放rtmp链接.然而,它不是在玩.我该怎么办?
self.avAsset = AVAsset(URL: NSURL(string: rtmpUrlString)!)
Run Code Online (Sandbox Code Playgroud)
谢谢.
我正在尝试使用 laravel 5.3 构建查询。但当我进行此查询时,我收到此错误。
错误:
SQLSTATE[42000]: 语法错误或访问冲突: 1055 'laravel.location.locationDate' 不在 GROUP BY 中 (SQL: select count(*), locationDate from where
location=tagCode24930 andxLocation> -1 andxLocation< 194 andyLocation> 60 andyLocation< 190 和created_at> 2017-03-09 00:00:01 和created_at< 2017-03-09 23:59:59 按 DATE(locationDate)、hour(locationDate)) 分组
顺便说一句,如果我复制查询并尝试在 sql 中运行它,它就可以工作。但我只是将引号添加到created_at,例如'2017-03-09 00:00:01'
这是我的代码..
$zoneTime = DB::table('location')
->select(DB::raw('count(*), locationDate'))
->where('tagCode', $tagCode)
->where('xLocation', '>', $workingZone->x1)
->where('xLocation', '<', $workingZone->x3)
->where('yLocation', '>', $workingZone->y3)
->where('yLocation', '<', $workingZone->y1)
->where('created_at', '>', $startDate)
->where('created_at', …Run Code Online (Sandbox Code Playgroud) 我需要检查加载到UIImage目标文件中的文件是否等于另一个图像并执行某些操作(如果是这样).不幸的是,它没有用.
emptyImage = UIImage(named: imageName)
if(image1.image != emptyImage) {
// do something
} else {
// do something
}
Run Code Online (Sandbox Code Playgroud)
上面的代码总是进入if分支.
我正在尝试在我的项目中使用螺栓.
当我尝试使用带有继续的螺栓时,我收到此错误.
Ambiguous use of 'continue'
Run Code Online (Sandbox Code Playgroud)
这也是我的代码.
return PFUser._privateDigitsLoginWithConfiguration(configuration: configuration).continue{ task in
guard let result = task.result as? [String:AnyObject] else {
return nil
}
let requestURLString = result[Constants.requestURLStringKey] as! String
let authorizationHeader = result[Constants.authorizationHeaderKey] as! String
print(Constants)
return PFCloud.callFunction(inBackground: "loginWithDigits", withParameters: ["requestURL": requestURLString, "authHeader": authorizationHeader])
}.continue {
PFUser.become(inBackground: $0.result as! String)
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的mac中使用opencv和python来匹配对象.
但是我收到了这个错误.
OpenCV: Cannot Use FaceTime HD Kamera (Yerle?ik)
OpenCV: camera failed to properly initialize!
Segmentation fault: 11
Run Code Online (Sandbox Code Playgroud)
这也是我的代码.
import numpy as np
import cv2
import time
ESC=27
camera = cv2.VideoCapture(0)
orb = cv2.ORB_create()
while True:
ret, imgCamColor = camera.read()
imgCamGray = cv2.cvtColor(imgCamColor, cv2.COLOR_BGR2GRAY)
kpCam = orb.detect(imgCamGray,None)
kpCam, desCam = orb.compute(imgCamGray, kpCam)
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)
matches = bf.match(desCam,desTrain)
good = []
cv2.imshow('Camara', result)
key = cv2.waitKey(20)
if key == ESC:
break
cv2.destroyAllWindows()
camera.release()
Run Code Online (Sandbox Code Playgroud)
我也尝试了一些东西.但它不起作用.
我正在尝试按时间值组合多个数组。我有一个这样的数组。
[
{
x:"Kasa",
y:" 8",
id:6,
a:0.019444444444444
},
{
x:"Kasa",
y:" 9",
id:6,
a:0.023611111111111
},
{
x:"Kasa",
y:"10",
id:6,
a:0.018055555555556
},
{
x:"Kasa",
y:"11",
id:6,
a:0.025
},
{
x:"Kasa",
y:"12",
id:6,
a:0.0097222222222222
}
],
[
{
x:"Kasap",
y:" 8",
id:7,
a:0.0013888888888889
},
{
x:"Kasap",
y:" 9",
id:7,
a:0.015277777777778
},
{
x:"Kasap",
y:"10",
id:7,
a:0.0027777777777778
},
{
x:"Kasap",
y:"11",
id:7,
a:0.0041666666666667
},
{
x:"Kasap",
y:"12",
id:7,
a:0.019444444444444
}
]
Run Code Online (Sandbox Code Playgroud)
我需要将这 2 个数组与 y 值结合起来。例如组合数组后应该是这样的。
[
{
x:"Kasa",
y:" 8",
id:6, …Run Code Online (Sandbox Code Playgroud) swift ×6
ios ×3
ios9 ×2
laravel ×2
php ×2
python ×2
arrays ×1
avplayer ×1
contacts ×1
django ×1
for-loop ×1
javascript ×1
jquery ×1
laravel-5 ×1
laravel-5.3 ×1
leaflet ×1
mysql ×1
opencv ×1
orb ×1
rtmp ×1
scrapy ×1
sql-server ×1
swift3 ×1
uicolor ×1
uiimage ×1
uitableview ×1
xcode ×1
xcode7 ×1