当我尝试粘贴即使只有10,000行文本时,Xcode也会崩溃。
基本上我试图将一个中文字典放入Realm.io数据库。以下是示例文本:
var word993 = Word(); word993.traditional = "三尖杉酯鹼"; word993.simplified = "三尖杉酯碱"; word993.pinyin = "[san1 jian1 shan1 zhi3 jian3]"; word993.english = "/harringtonine (chemistry)/"; chineseEnglishDictionary.addObject(word993);
var word994 = Word(); word994.traditional = "三屜桌"; word994.simplified = "三屉桌"; word994.pinyin = "[san1 ti2 zhuo1]"; word994.english = "/three-drawer desk (traditional Chinese piece of furniture)/"; chineseEnglishDictionary.addObject(word994);
var word995 = Word(); word995.traditional = "三山"; word995.simplified = "三山"; word995.pinyin = "[San1 shan1]"; word995.english = "/Sanshan district of Wuhu city 蕪湖市|芜湖市[Wu2 hu2 shi4], Anhui/"; chineseEnglishDictionary.addObject(word995);
var word996 = Word(); word996.traditional = "三山區"; word996.simplified = "三山区"; word996.pinyin = "[San1 shan1 qu1]"; word996.english = "/Sanshan district of Wuhu city 蕪湖市|芜湖市[Wu2 hu2 shi4], Anhui/"; chineseEnglishDictionary.addObject(word996);
var word997 = Word(); word997.traditional = "三岔口"; word997.simplified = "三岔口"; word997.pinyin = "[San1 cha4 kou3]"; word997.english = "/At the Crossroads, famous opera, based on a story from 水滸傳|水浒传[Shui3 hu3 Zhuan4]/"; chineseEnglishDictionary.addObject(word997);
var word998 = Word(); word998.traditional = "三島由紀夫"; word998.simplified = "三岛由纪夫"; word998.pinyin = "[San1 dao3 You2 ji4 fu1]"; word998.english = "/Mishima Yukio (1925-1970), Japanese author, pen name of (平岡公威|平冈公威, Hiraoka Kimitake)/"; chineseEnglishDictionary.addObject(word998);
var word999 = Word(); word999.traditional = "三峽"; word999.simplified = "三峡"; word999.pinyin = "[San1 xia2]"; word999.english = "/Three Gorges on the Chang Jiang or Yangtze, namely: Qutang Gorge 瞿塘峽|瞿塘峡[Qu1 tang2 Xia2], Wuxia Gorge 巫峽|巫峡[Wu1 Xia2]; chineseEnglishDictionary.addObject(word999);
如何使用这么多行代码而不会崩溃?
答案 0 :(得分:3)
没有任何关于XCode崩溃或崩溃信息的线索。 但是我没有以编程方式输入文本,而是建议你创建一个文本文件,每个单词集逗号分隔在一个单独的行上,然后创建一个打开文件的小程序,并迭代这些行并将它们插入到域中一个人。然后,您可以在程序中包含数据库文件。