gpt4 book ai didi

ios - 我想将 .plist 转换为 sqlite

转载 作者:行者123 更新时间:2023-11-29 04:11:11 26 4
gpt4 key购买 nike

我正在使用 plist 将数十个数据解析为 tableview。它工作得很好。然而,它是不 protected 。如果有人打开 .ipa 文件的内容,就可以轻松访问该 plist 文件。我想保护我的数据。有没有办法保护 .plist 文件?据我所知,Sqlite 通过将值更改为复杂的键来保护数据。然而,如果我要在我的应用程序中使用 sqlite,我必须更改将数据解析为字符串的方式。我对 SQLite 一无所知。

从哪里开始?你有什么建议?有没有更简单、更好的方法来保护 iOS 应用程序中的数据?

提前致谢。

我的 plist 示例:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>quizName</key>
<string>History</string>
<key>quizDescription</key>
<string>Check your knowledge about great historical events, who did what where to whom!</string>
<key>quizImageName</key>
<string>quiz-history.png</string>
<key>questions</key>
<array>
<dict>
<key>question</key>
<string>In monarchy, for how long does the head of state rule?</string>
<key>answers</key>
<array>
<string>5 years</string>
<string>until someone else is elected</string>
<string>as long as he/she is the party leader</string>
<string>until death or abdication</string>
</array>
<key>correctAnswerIndex</key>
<integer>3</integer>
</dict>
<dict>
<key>question</key>
<string>When was World War 2 fought?</string>
<key>answers</key>
<array>
<string>1935 - 1939</string>
<string>1914 - 1918</string>
<string>1939 - 1945</string>
<string>1918 - 1939</string>
</array>
<key>correctAnswerIndex</key>
<integer>2</integer>
</dict>
<dict>
<key>question</key>
<string>Peloponnesian War was famous greek war between...</string>
<key>answers</key>
<array>
<string>Athens and Sparta</string>
<string>Greece and Persia</string>
<string>Athens and Attica</string>
<string>Greece and Macedonia</string>
</array>
<key>correctAnswerIndex</key>
<integer>0</integer>
</dict>
<dict>
<key>question</key>
<string>Battle of the Pyramids was fought between which two forces?</string>
<key>answers</key>
<array>
<string>Egypt and Rome</string>
<string>French and Mamluk</string>
<string>Egypt and Persia</string>
<string>Mamluk and Rome</string>
</array>
<key>correctAnswerIndex</key>
<integer>1</integer>
</dict>
<dict>
<key>question</key>
<string>First Winter Olypmics were held in...</string>
<key>answers</key>
<array>
<string>Italy, 1920</string>
<string>Germany, 1921</string>
<string>England, 1928</string>
<string>France, 1924</string>
</array>
<key>correctAnswerIndex</key>
<integer>3</integer>
</dict>
</array>
</dict>
<dict>
<key>quizName</key>
<string>Animal kingdom</string>
<key>quizDescription</key>
<string>Not sure how many legs does the spider have? Test your knowledge and find out!</string>
<key>quizImageName</key>
<string>quiz-animals.png</string>
<key>questions</key>
<array>
<dict>
<key>question</key>
<string>Where were the cats domesticated?</string>
<key>answers</key>
<array>
<string>In Greece, around 500 B.C.</string>
<string>In ancient Egypt, around 1.600 B.C.</string>
<string>In China, around 2.000 B.C.</string>
<string>In Mongolia, around 1.400 B.C.</string>
</array>
<key>correctAnswerIndex</key>
<integer>1</integer>
</dict>
<dict>
<key>question</key>
<string>Dogs have a range of hearing of...</string>
<key>answers</key>
<array>
<string>approximately 40 Hz to 60,000 Hz</string>
<string>approximately 10,000 Hz to 60,000 Hz</string>
<string>approximately 40 Hz to 5,000 Hz</string>
<string>approximately 5,000 Hz to 30,000 Hz</string>
</array>
<key>correctAnswerIndex</key>
<integer>0</integer>
</dict>
<dict>
<key>question</key>
<string>Meerkats can be found where?</string>
<key>answers</key>
<array>
<string>Australia</string>
<string>north Africa and south-west Asia</string>
<string>south Africa</string>
<string>Africa and Australia</string>
</array>
<key>correctAnswerIndex</key>
<integer>2</integer>
</dict>
<dict>
<key>question</key>
<string>Biggest mammal is...</string>
<key>answers</key>
<array>
<string>Blue whale</string>
<string>Elephant</string>
<string>Killer whale</string>
<string>Rhinoceros</string>
</array>
<key>correctAnswerIndex</key>
<integer>0</integer>
</dict>
<dict>
<key>question</key>
<string>Which of these animals sheads it&apos;s skin?</string>
<key>answers</key>
<array>
<string>monkey</string>
<string>narwal</string>
<string>snake</string>
<string>cow</string>
</array>
<key>correctAnswerIndex</key>
<integer>2</integer>
</dict>
</array>
</dict>
</array>
</plist>

最佳答案

如果您只想加密您的 plist 文件,请查看 at this SO question .

如果你真的想要sqlite,那么不要直接处理sqlite,看看CoreData . Core data 是一个 Apple 框架,它使得使用 NSObject 和关系来存储和获取数据变得非常容易。如果需要的话,核心数据可以使用sqlite来存储。学习曲线相当陡峭,但值得学习,因为它是一个非常有用的框架,需要掌握。

请记住,sqlite 数据库仅存储在默认情况下任何人都可以读取的文件中。因此您需要付出更多的努力来加密它。

关于ios - 我想将 .plist 转换为 sqlite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14387293/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com