我有字典:
from bs4 import BeautifulSoup
import requests
r = requests.get('https://old.mciindia.org/InformationDesk/IndianMedicalRegister.aspx')
soup = BeautifulSoup(r.text,'lxml')
for links in soup.find('tr',class_='row'):
for link in links.find('a',id_='lnkDesc'):
print link['href']
我的消息类别:
var swiftBlogs:[Message] = [Message]()
我正在更新某些消息的发送状态,例如:
class Message: Object {
@objc dynamic var incoming=false
@objc dynamic var text = ""
@objc dynamic var from = ""
@objc dynamic var fromMe = 0
@objc dynamic var roomName = ""
@objc dynamic var time=0
@objc dynamic var isInfo=false
@objc dynamic var me=""
@objc dynamic var messageId=0
@objc dynamic var localId=0
@objc dynamic var isSent=1
@objc dynamic var isRibbon=0
@objc dynamic var ribbonJson = ""
@objc dynamic var isImage=0
@objc dynamic var isVoice=0
@objc dynamic var serverTime=0
}
实际上,它运行良好,但是我从用户那里看到太多有关此行的崩溃报告:
let messageInfo:Dictionary<String,Message?> = notification.userInfo as! Dictionary<String,Message?>
let m1 = messageInfo["m"]
if let i = swiftBlogs.index(where: {$0.localId == m1!?.localId}) {
swiftBlogs[i].isSent=1
}
例外:
if let i = swiftBlogs.index(where: {$0.localId == m1!?.localId}) {
完整的崩溃日志:
2 Realm 0x10498ec08 long long (anonymous namespace)::get<long long>(RLMObjectBase*, unsigned long) + 164 (RLMObject_Private.hpp:45)
问题出在哪里?