{"id":681,"date":"2010-12-01T17:54:36","date_gmt":"2010-12-01T08:54:36","guid":{"rendered":"http:\/\/yamazon.org\/?p=681"},"modified":"2010-12-01T17:54:36","modified_gmt":"2010-12-01T08:54:36","slug":"6sqlite%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6todo%e3%83%aa%e3%82%b9%e3%83%88%e3%82%a2%e3%83%97%e3%83%aa%e3%82%92%e4%bd%9c%e6%88%90","status":"publish","type":"post","link":"https:\/\/apr20.net\/?p=681","title":{"rendered":"[6]:SQLite\u3092\u4f7f\u3063\u3066ToDo\u30ea\u30b9\u30c8\u30a2\u30d7\u30ea\u3092\u4f5c\u6210(1)"},"content":{"rendered":"<p>\u3053\u306e\u30d6\u30ed\u30b0\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u9806\u306b\u8aad\u307f\u9032\u3081\u3066\u304f\u3060\u3055\u3063\u305f\u65b9\u306a\u3089\u3001\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u304cUITableVIew\u3092\u512a\u5148\u7684\u306b\u53d6\u308a\u7d44\u3093\u3067\u304d\u305f\u3053\u3068\u3092\u3054\u5b58\u77e5\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u7406\u7531\u3068\u3057\u3066\u306f\u3001\u591a\u304f\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u3001\u3053\u306e\u30b7\u30f3\u30d7\u30eb\u306a\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3092\u4f7f\u3063\u3066\u958b\u767a\u3055\u308c\u3066\u3044\u308b\u304b\u3089\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306fUITableView\u306e\u6700\u5f8c\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3068\u3057\u3066\u3001\u4eca\u307e\u3067\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u5b66\u3093\u3067\u304d\u305f\u3053\u3068\u3092\u3059\u3079\u3066\u4f7f\u3044\u3001SQLite\u306e\u6280\u8853\u3092\u8ffd\u52a0\u3057\u3001ToDo\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u591a\u304f\u306e\u6a5f\u80fd\u3092\u6301\u3063\u305f\u30c6\u30fc\u30d6\u30eb\u30bb\u30eb\u3092\u8ffd\u52a0\u3057\u3001iPhone\u304c\u63d0\u4f9b\u3057\u3066\u3044\u308b\u4ed6\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306b\u3064\u3044\u3066\u3082\u5b66\u3093\u3067\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u904e\u53bb\u306e\u8a18\u4e8b\u3092\u65e2\u8aad\u306e\u65b9\u3092\u60f3\u5b9a\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u307e\u3060\u306e\u65b9\u306f\u3001\u305d\u3061\u3089\u306e\u8a18\u4e8b\u306b\u5148\u306b\u76ee\u3092\u901a\u3055\u308c\u308b\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306f\u3001\u3044\u304f\u3064\u304b\u306e\u30b7\u30ea\u30fc\u30ba\u304b\u3089\u6210\u308a\u7acb\u3064\u306e\u3067\u3001\u904e\u53bb\u306e\u8a18\u4e8b\u306b\u6bd4\u3079\u5c11\u3057\u9577\u304f\u306a\u308a\u307e\u3059\u3002\u3053\u306e\u6700\u521d\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u5b66\u3076\u3053\u3068\u306f\u4ee5\u4e0b\u3067\u3059\u3002<\/p>\n<p style=\"margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;\"><strong>\u4eca\u56de\u5b66\u3076\u3053\u3068\uff1a<\/strong><\/p>\n<ul style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin: 0px;\">\n<li style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-position: inside; margin: 0px;\"><span style=\"color: #008000;\">Navigation-Based Application \u306e\u65b0\u898f\u4f5c\u6210<\/span><\/li>\n<li style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-position: inside; margin: 0px;\"><span style=\"color: #008000;\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4f5c\u6210<\/span><\/li>\n<li style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-position: inside; margin: 0px;\"><span style=\"color: #008000;\">\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u8ffd\u52a0<\/span><\/li>\n<li style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-position: inside; margin: 0px;\"><span style=\"color: #008000;\">SQLite3\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u8ffd\u52a0<\/span><\/li>\n<li style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-position: inside; margin: 0px;\"><span style=\"color: #008000;\">ToDo\u30af\u30e9\u30b9\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210<\/span><\/li>\n<li style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-position: inside; margin: 0px;\"><span style=\"color: #008000;\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u521d\u671f\u5316<\/span><\/li>\n<\/ul>\n<p><!--more-->\u305d\u308c\u3067\u306f\u59cb\u3081\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>XCode\u3092\u8d77\u52d5\u3057\u3001\u65b0\u898f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<strong>Navigation-Based Application <\/strong>\u3092\u9078\u629e\u3057\u3001\u540d\u524d\u306f\u300ctodo\u300d\u3068\u3057\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306b\u3001todo\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3042\u306a\u305f\u306eMac\u4e0a\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3092\u8d77\u52d5\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 \uff1e \u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3 \uff1e \u30bf\u30fc\u30df\u30ca\u30eb \u306b\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002\u5206\u304b\u3089\u306a\u3044\u65b9\u306f\u3001control + space \u3067 Spotlight \u3092\u8d77\u52d5\u3057\u3001\u300c\u30bf\u30fc\u30df\u30ca\u30eb\u300d\u3082\u3057\u304f\u306f\u3001\u300cterminal\u300d\u3068\u5165\u529b\u3059\u308c\u3070\u3001\u898b\u3064\u304b\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u3092\u4f7f\u3063\u3066\u3001SQLite\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u66f8\u304d\u307e\u3059\u304c\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u304c\u82e6\u624b\u306a\u65b9\u306f\u3001<a href=\"http:\/\/yamazon.org\/iphone-app-develop-tips\/tutorial\/760\">\u4fbf\u5229\u306aGUI\u30c4\u30fc\u30eb\u3092\u4f7f\u3063\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210<\/a>\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u306e\u3067\u3001\u305d\u306e\u5834\u5408\u306f\u3001<a href=\"http:\/\/yamazon.org\/iphone-app-develop-tips\/tutorial\/760\">\u3053\u3061\u3089\u306e\u8a18\u4e8b<\/a>\u3092\u53c2\u8003\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>XCode\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308c\u3070\u3001\u65e2\u306bsqlite3\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6e08\u3060\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u4e0a\u3067\u3001<\/p>\n<blockquote><p>sqlite3<\/p><\/blockquote>\n<p>\u3068\u5165\u529b\u3057\u307e\u3059\u3002\u3053\u308c\u3067sqlite3\u304c\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<p>sqlite3\u3092\u7d42\u4e86\u3059\u308b\u306b\u306f<\/p>\n<blockquote><p>.quit<\/p><\/blockquote>\n<p>\u3068\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/developer.apple.com\/library\/mac\/#documentation\/Darwin\/Reference\/ManPages\/man1\/sqlite3.1.html\">SQLite \u306e\u4f7f\u3044\u65b9<\/a><\/p>\n<p>\u3082\u3057\u3001sqlite3\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u3001\u30cd\u30c3\u30c8\u691c\u7d22\u3059\u308c\u3070\u3001\u591a\u304f\u306e\u8a18\u4e8b\u304c\u898b\u3064\u304b\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<blockquote><p>sqlite3 todo.sqlite<\/p><\/blockquote>\n<p>\u30bf\u30fc\u30df\u30ca\u30eb\u4e0a\u304b\u3089sqlite\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3044\u306a\u3044\u72b6\u614b\u3067\u3001\u4e0a\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\u3053\u308c\u3067\u3001SQLite\u304c\u8d77\u52d5\u3057\u3001\u300ctodo.sqlite\u300d\u3068\u3044\u3046\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u8aad\u307f\u8fbc\u307e\u308c\u307e\u3059\u3002\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u521d\u671f\u72b6\u614b\u3067\u306f\u3001\u30c6\u30fc\u30d6\u30eb\u306f\u5b58\u5728\u305b\u305a\u3001\u7a7a\u306e\u72b6\u614b\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u4f5c\u6210\u3059\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u5358\u7d14\u306a\u306e\u3067\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306f\uff11\u3064\u306e\u307f\u4f5c\u6210\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3001\u300ctodo\u300d\u3068\u3044\u3046\u540d\u524d\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<blockquote><p>CREATE TABLE todo(pk INTEGER PRIMARY KEY, text VARCHAR(25), priority INTEGER, complete BOOLEAN);<\/p><\/blockquote>\n<p>sqlite\u5185\u3067\u4f7f\u3046\u30b3\u30de\u30f3\u30c9\u306f\u6700\u5f8c\u306b\u300c;\u300d\u304c\u5fc5\u8981\u3067\u3059\u3002\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u4f5c\u6210\u30b3\u30de\u30f3\u30c9\u306e\u5f62\u5f0f\u306f\u3001\u4ee5\u4e0b\u3067\u3059\u3002<\/p>\n<blockquote><p><span style=\"color: #ff0000;\">create table \u30c6\u30fc\u30d6\u30eb\u540d(\u30ab\u30e9\u30e0\u540d \u30ab\u30e9\u30e0\u5b9a\u7fa9, \u30ab\u30e9\u30e0\u540d \u30ab\u30e9\u30e0\u5b9a\u7fa9, \u30fb\u30fb\u30fb);<\/span><\/p><\/blockquote>\n<p>\u5148\u307b\u3069\u5b9f\u884c\u3057\u305f\u30b3\u30de\u30f3\u30c9\u3092\u7c21\u5358\u306b\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<p>\u6700\u521d\u306e CREATE TABLE todo \u306f\u3001todo\u3068\u3044\u3046\u540d\u524d\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002<\/p>\n<p>\u62ec\u5f27\u306e\u4e2d\u306e pk INTEGER PRIMARY KEY \u306f\u3001integer\u578b\u306e\u300cpk\u300d\u3068\u3044\u3046\u540d\u524d\u306e\u30ab\u30e9\u30e0\u3092\u4f5c\u308a\u3001\u30c6\u30fc\u30d6\u30eb\u306e\u30d7\u30e9\u30a4\u30de\u30ea\u30fc\u30ad\u30fc\u306b\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002\u30d7\u30e9\u30a4\u30de\u30ea\u30fc\u30ad\u30fc\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u3053\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u884c(\u9805\u76ee)\u304c\u8ffd\u52a0\u3055\u308c\u308b\u3054\u3068\u306b\u3001\u3053\u306epk \u304c\uff11\u3064\u305a\u3064\u5897\u52a0\u3057\u3066\u3044\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u5404\u884c\u3092\u30e6\u30cb\u30fc\u30af\u306a\u3082\u306e\u3068\u3057\u3066\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u4ed6\u306e\u9805\u76ee\u306f\u3001\u30d7\u30e9\u30a4\u30de\u30ea\u30fc\u30ad\u30fc\u4ee5\u5916\u306e\u90e8\u5206\u306f\u540c\u3058\u4ed5\u69d8\u306a\u306e\u3067\u3001\u5206\u304b\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3067\u3001\u5fc5\u8981\u306a\u30c6\u30fc\u30d6\u30eb\u304c\u4f5c\u6210\u3055\u308c\u307e\u3057\u305f\u306e\u3067\u3001\u3044\u304f\u3064\u304b\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002\u6700\u7d42\u7684\u306b\u306f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5074\u304b\u3089todo\u9805\u76ee\u3092\u8ffd\u52a0\u3057\u3066\u3044\u304d\u307e\u3059\u304c\u3001\u4eca\u306f\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u304b\u3089\u3001\u3044\u304f\u3064\u304b\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u3082\u306e\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<blockquote><p>INSERT INTO todo(text,priority,complete) VALUES(&#8216;iPhone\u3092\u8cb7\u3046&#8217;,3,0);<br \/>\nINSERT INTO todo(text,priority,complete) VALUES(&#8216;SQLite\u3092\u52c9\u5f37\u3059\u308b&#8217;,1,0);<br \/>\nINSERT INTO todo(text,priority,complete) VALUES(&#8216;Objective-C\u3092\u52c9\u5f37\u3059\u308b&#8217;,1,0);<br \/>\nINSERT INTO todo(text,priority,complete) VALUES(&#8216;\u30b4\u30df\u3092\u6368\u3066\u306b\u884c\u304f&#8217;,2,0);<\/p><\/blockquote>\n<p>\u3053\u308c\u3067\u3044\u304f\u3064\u304b\u306etodo\u9805\u76ee\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f\u3002priority \u306e\u5024\u306f1~3\u306e\u6570\u5024\u304c\u914d\u7f6e\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u308c\u306b\u3064\u3044\u3066\u306f\u3001\u5f8c\u307b\u3069\u89e6\u308c\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002(\u8aac\u660e\u304c\u4e0d\u8981\u306a\u8aad\u8005\u3082\u591a\u3044\u304b\u3068\u306f\u601d\u3044\u307e\u3059\u304c&#8230;)<\/p>\n<p>\u3053\u3053\u307e\u3067\u3067\u3001\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306f\u4f5c\u6210\u3055\u308c\u307e\u3057\u305f\u306e\u3067\u3001sqlite3\u3092\u7d42\u4e86\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u3001XCode\u306b\u623b\u308a\u307e\u3057\u3087\u3046\u3002<strong>Resources <\/strong>\u30d5\u30a9\u30eb\u30c0\u3092\u53f3\u30af\u30ea\u30c3\u30af(ctrl + \u30af\u30ea\u30c3\u30af )\u3057\u3001\u8ffd\u52a0 \uff1e \u65e2\u5b58\u306e\u30d5\u30a1\u30a4\u30eb \u304b\u3089\u3001\u5148\u307b\u3069\u4f5c\u6210\u3057\u305ftodo.sqlite \u30d5\u30a1\u30a4\u30eb\u3092\u63a2\u3057\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u3001\/Users\/\u30e6\u30fc\u30b6\u30fc\u540d\/ \u306e\u5834\u6240\u306bsqlite\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u3092\u898b\u3064\u3051\u3066\u8ffd\u52a0\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u753b\u9762\u304c\u51fa\u3066\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/yamazon.org\/wp-content\/uploads\/2010\/12\/6-11.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-690\" title=\"6-1\" src=\"http:\/\/yamazon.org\/wp-content\/uploads\/2010\/12\/6-11-300x215.jpg\" alt=\"6-1\" width=\"300\" height=\"215\" \/><\/a><\/p>\n<p>\u300c\u30c7\u30b9\u30c6\u30a3\u30cd\u30fc\u30b7\u30e7\u30f3&#8230;\u300d\u306e\u9805\u76ee\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u300c\u8ffd\u52a0\u300d\u3092\u30af\u30ea\u30c3\u30af\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u8ffd\u52a0\u3055\u308c\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306bResource\u30d5\u30a9\u30eb\u30c0\u306b\u8ffd\u52a0\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/yamazon.org\/wp-content\/uploads\/2010\/12\/6-2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-692\" title=\"6-2\" src=\"http:\/\/yamazon.org\/wp-content\/uploads\/2010\/12\/6-2-300x214.jpg\" alt=\"6-2\" width=\"300\" height=\"214\" \/><\/a><\/p>\n<p>\u3053\u308c\u3067\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u8ffd\u52a0\u304c\u51fa\u6765\u307e\u3057\u305f\u306e\u3067\u3001\u3053\u308c\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306bObjective-C\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002<\/p>\n<p><strong>Frameworks <\/strong>\u30d5\u30a9\u30eb\u30c0\u3092\u53f3\u30af\u30ea\u30c3\u30af\u3057\u3001\u8ffd\u52a0 \uff1e \u65e2\u5b58\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u9078\u629e\u3057\u307e\u3059\u3002\u300c<strong>libsqlite3.0.dylib<\/strong>\u300d\u3092\u63a2\u3057\u3001\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/yamazon.org\/wp-content\/uploads\/2010\/12\/6-3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-694\" title=\"6-3\" src=\"http:\/\/yamazon.org\/wp-content\/uploads\/2010\/12\/6-3-300x232.jpg\" alt=\"6-3\" width=\"300\" height=\"232\" \/><\/a>\u3053\u308c\u3067\u4ee5\u4e0b\u306e\u753b\u50cf\u306e\u3088\u3046\u306b\u9078\u629e\u3057\u305f\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/yamazon.org\/wp-content\/uploads\/2010\/12\/6-4.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-695\" title=\"6-4\" src=\"http:\/\/yamazon.org\/wp-content\/uploads\/2010\/12\/6-4-300x215.jpg\" alt=\"6-4\" width=\"300\" height=\"215\" \/><\/a><\/p>\n<p>todo\u306e\u60c5\u5831\u3092\u6271\u3046\u305f\u3081\u306b\u3001\u3042\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u6700\u7d42\u7684\u306b\u306f\u3001\u3053\u308c\u3089\u306e\u60c5\u5831\u306e\u914d\u5217\u3092\u4f5c\u6210\u3057UITableView\u3067\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>XCode\u4e0a\u304b\u3089 \u30d5\u30a1\u30a4\u30eb \uff1e \u65b0\u898f\u30d5\u30a1\u30a4\u30eb\u3092\u30af\u30ea\u30c3\u30af\u3057\u3001<strong>NSObject <\/strong>\u306e\u30b5\u30d6\u30af\u30e9\u30b9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/yamazon.org\/wp-content\/uploads\/2010\/12\/6-5.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-697\" title=\"6-5\" src=\"http:\/\/yamazon.org\/wp-content\/uploads\/2010\/12\/6-5-300x242.jpg\" alt=\"6-5\" width=\"300\" height=\"242\" \/><\/a><\/p>\n<p>\u540d\u524d\u306f\u3001<strong>Todo.m<\/strong>\u3068\u3057\u3066\u3001\u201d\u540c\u6642\u306btodo.h\u3082\u4f5c\u6210\u3059\u308b\u201d\u306b\u30c1\u30a7\u30c3\u30af\u3057\u3001\u4fdd\u5b58\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>Todo.h<\/strong>\u3092\u958b\u304d\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u7de8\u96c6\u3057\u307e\u3059\u3002<\/p>\n<blockquote>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12e1b;\"><span style=\"color: #78492a;\">#import <\/span>&lt;Foundation\/Foundation.h&gt;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12e1b;\"><span style=\"color: #78492a;\">#import <\/span>&lt;sqlite3.h&gt;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"color: #bb2da2;\">@interface<\/span> Todo : NSObject {<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4e8187;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #703daa;\">sqlite3<\/span><span style=\"color: #000000;\"> *<\/span>database<span style=\"color: #000000;\">;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4e8187;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #703daa;\">NSInteger<\/span><span style=\"color: #000000;\"> <\/span>primaryKey<span style=\"color: #000000;\">;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span>NSString<span style=\"color: #000000;\"> *<\/span><span style=\"color: #4e8187;\">text<\/span><span style=\"color: #000000;\">;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">}<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\">@property<span style=\"color: #000000;\"> (<\/span>assign<span style=\"color: #000000;\">,<\/span>nonatomic<span style=\"color: #000000;\">,<\/span>readonly<span style=\"color: #000000;\">)NSInteger primaryKey;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\">@property<span style=\"color: #000000;\"> (<\/span>nonatomic<span style=\"color: #000000;\">,<\/span>retain<span style=\"color: #000000;\">)NSString *text;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">-(<span style=\"color: #bb2da2;\">id<\/span>)initWithPrimaryKey:(<span style=\"color: #703daa;\">NSInteger<\/span>)pk database:(<span style=\"color: #703daa;\">sqlite3<\/span> *)db;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\">@end<\/p>\n<\/blockquote>\n<p>\u3044\u304f\u3064\u304b\u306e\u65b0\u3057\u3044\u8a18\u8ff0\u304c\u3042\u308a\u307e\u3059\u306d\u3002\u307e\u305a\u3001sqlite3\u578b\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u5909\u6570\u3067\u3059\u3002\u3053\u308c\u306f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u53c2\u7167\u3057\u3001todo\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u3084\u308a\u3068\u308a\u3092\u53ef\u80fd\u306b\u3059\u308b\u3082\u306e\u3067\u3059\u3002#import\u6587\u3092\u5fd8\u308c\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u6b21\u306b\u3001primary key \u306b\u3064\u3044\u3066\u3067\u3059\u304c\u3001\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u5ba3\u8a00\u3055\u308c\u3066\u3044\u308bassign\u3068readonly\u306f\u3001\u30b3\u30f3\u30d1\u30a4\u30e9\u306b\u3053\u306e\u5909\u6570\u306f\u4e00\u5ea6\u8a2d\u5b9a\u3055\u308c\u308b\u3068\u3001\u5909\u66f4\u3055\u308c\u306a\u3044\u3068\u5ba3\u8a00\u3059\u308b\u3082\u306e\u3067\u3059\u3002\u3053\u308c\u306b\u3088\u3063\u3066\u3001\u5404todo\u9805\u76ee\u306f\u30e6\u30cb\u30fc\u30af\u3060\u3068\u5b9a\u7fa9\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><span style=\"color: #888888;\">This tells the compiler that this variable, once assiged, can not be changed again.\u00a0 This is good since each todo will be uniquely identified by this variable.<\/span><\/p>\n<p>\u307e\u305f\u3001initWithPrimaryKey \u3092\u5ba3\u8a00\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u308c\u306f\u3053\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u3059\u3002\u3053\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306f\u3001\u6574\u6570\u578b\u3092\u3068\u308a\u307e\u3059\u3002<\/p>\n<p><span style=\"color: #888888;\">It takes an integer to assign as the primary key and an sqlite3 object to use as the database reference.<\/span><\/p>\n<p>\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u5b9f\u88c5\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><strong>Todo.m <\/strong>\u3092\u958b\u304d\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u7de8\u96c6\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<blockquote>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #78492a;\">#import <span style=\"color: #d12e1b;\">&#8220;Todo.h&#8221;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"color: #bb2da2;\">static<\/span> sqlite3_stmt *init_statement = <span style=\"color: #bb2da2;\">nil<\/span>;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\">@implementation<span style=\"color: #000000;\"> Todo<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"color: #bb2da2;\">@synthesize<\/span> primaryKey,text;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">-(<span style=\"color: #bb2da2;\">id<\/span>)initWithPrimaryKey:(<span style=\"color: #703daa;\">NSInteger<\/span>)pk database:(<span style=\"color: #703daa;\">sqlite3<\/span> *)db {<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span>if<span style=\"color: #000000;\">(<\/span>self<span style=\"color: #000000;\"> = [<\/span>super<span style=\"color: #000000;\"> <\/span><span style=\"color: #3d1e81;\">init<\/span><span style=\"color: #000000;\">]){<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4e8187;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span>primaryKey<span style=\"color: #000000;\"> = pk;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span><span style=\"color: #4e8187;\">database<\/span> = db;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4e8187;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #bb2da2;\">if<\/span><span style=\"color: #000000;\"> (<\/span>init_statement<span style=\"color: #000000;\"> == <\/span><span style=\"color: #bb2da2;\">nil<\/span><span style=\"color: #000000;\">) {<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12e1b;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #bb2da2;\">const<\/span><span style=\"color: #000000;\"> <\/span><span style=\"color: #bb2da2;\">char<\/span><span style=\"color: #000000;\"> *sql = <\/span>&#8220;SELECT text FROM todo WHERE pk=?&#8221;<span style=\"color: #000000;\">;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span><span style=\"color: #bb2da2;\">if<\/span>(<span style=\"color: #3d1e81;\">sqlite3_prepare_v2<\/span>(<span style=\"color: #4e8187;\">database<\/span>, sql, &#8211;<span style=\"color: #252bd8;\">1<\/span>, &amp;<span style=\"color: #4e8187;\">init_statement<\/span>,<span style=\"color: #bb2da2;\">NULL<\/span>) != <span style=\"color: #78492a;\">SQLITE_OK<\/span>){<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12e1b;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #78492a;\">NSAssert1<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #252bd8;\">0<\/span><span style=\"color: #000000;\">, <\/span>@&#8221;Error:failed to prepare statement with message &#8216;%s&#8217;.&#8221;<span style=\"color: #000000;\">, <\/span><span style=\"color: #3d1e81;\">sqlite3_errmsg<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #4e8187;\">database<\/span><span style=\"color: #000000;\">));<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span>}<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span>}<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4e8187;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #3d1e81;\">sqlite3_bind_int<\/span><span style=\"color: #000000;\">(<\/span>init_statement<span style=\"color: #000000;\">, <\/span><span style=\"color: #252bd8;\">1<\/span><span style=\"color: #000000;\">, <\/span>primaryKey<span style=\"color: #000000;\">);<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4e8187;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #bb2da2;\">if<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #3d1e81;\">sqlite3_step<\/span><span style=\"color: #000000;\">(<\/span>init_statement<span style=\"color: #000000;\">)== <\/span><span style=\"color: #78492a;\">SQLITE_ROW<\/span><span style=\"color: #000000;\">){<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #3d1e81;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #bb2da2;\">self<\/span><span style=\"color: #000000;\">.<\/span><span style=\"color: #703daa;\">text<\/span><span style=\"color: #000000;\"> = [<\/span><span style=\"color: #703daa;\">NSString<\/span><span style=\"color: #000000;\"> <\/span>stringWithUTF8String<span style=\"color: #000000;\">\ud83d\ude41<\/span><span style=\"color: #bb2da2;\">char<\/span><span style=\"color: #000000;\"> *)<\/span>sqlite3_column_text<span style=\"color: #000000;\">(<\/span><span style=\"color: #4e8187;\">init_statement<\/span><span style=\"color: #000000;\">, <\/span><span style=\"color: #252bd8;\">0<\/span><span style=\"color: #000000;\">)];<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span>}<span style=\"color: #bb2da2;\">else<\/span> {<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12e1b;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #bb2da2;\">self<\/span><span style=\"color: #000000;\">.<\/span><span style=\"color: #703daa;\">text<\/span><span style=\"color: #000000;\"> = <\/span>@&#8221;Nothing&#8221;<span style=\"color: #000000;\">;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span>}<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4e8187;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #3d1e81;\">sqlite3_reset<\/span><span style=\"color: #000000;\">(<\/span>init_statement<span style=\"color: #000000;\">);<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span>}<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span> <\/span>return<span style=\"color: #000000;\"> <\/span>self<span style=\"color: #000000;\">;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">}<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\">@end<\/p>\n<\/blockquote>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u306b\u306f\u65b0\u3057\u3044\u8a18\u8ff0\u304c\u3044\u304f\u3064\u304b\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<blockquote><p>static sqlite3_stmt *init_statement = nil<\/p><\/blockquote>\n<p>\u3053\u308c\u306f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089todo\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3068\u304d\u306b\u521d\u671f\u5316\u3055\u308c\u305f\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u4fdd\u6301\u3057\u307e\u3059\u3002\u3053\u306e\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306f\u4efb\u610f\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304b\u3089\u72ec\u7acb\u3057\u3066\u304a\u308a\u3001\u9759\u7684\u3067\u3059\u3002<\/p>\n<p>-(id) \u304b\u3089\u59cb\u307e\u308b\u884c\u306f\u3001todo\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u521d\u671f\u5316\u3055\u308c\u308b\u524d\u306b\u3001\u89aa\u30af\u30e9\u30b9\u3067\u3042\u308bNSObject\u30af\u30e9\u30b9\u3092\u521d\u671f\u5316\u3057\u307e\u3059\u3002<\/p>\n<p>initWithPrimaryKey\u30e1\u30bd\u30c3\u30c9\u306b\u6e21\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u3001\u30ed\u30fc\u30ab\u30eb\u306e\u4e3b\u30ad\u30fc\u3068\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>if(init_statement == nil)\u306e\u884c\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u8d77\u52d5\u3054\u3068\u306b\u4e00\u5ea6\u3060\u3051\u767a\u751f\u3057\u307e\u3059\u3002\u3082\u3057\u3001\u305d\u308c\u304cnull\u306e\u5834\u5408\u306f\u3001SQL\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u542b\u3080\u65b0\u3057\u3044\u6587\u5b57\u5217\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>SQL\u306b\u8a73\u3057\u3044\u65b9\u306b\u306f\u3001\u4e00\u3064\u306e\u4f8b\u5916\u3092\u9664\u3044\u3066\u3001\u7c21\u5358\u306aSQL\u6587\u306b\u306a\u3063\u3066\u3044\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u306a\u3093\u3067\u201d\uff1f\u201d\u304c\u3042\u308b\u3093\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>SQL\u6587\u304c\u30b3\u30f3\u30d1\u30a4\u30eb\u3055\u308c\u305f\u5f8c\u3001\u305d\u3053(?\u30de\u30fc\u30af)\u306b\u5024\u3092\u7f6e\u304d\u63db\u3048\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p><span style=\"color: #888888;\">So this allows us to have 1 generic SQL statement, but bind different values to it to retrieve different results.<\/span><\/p>\n<p>sqlite3_prepare_v2\u00a0\u306e\u884c\u306f\u3001init_statement\u306b\u4fdd\u6301\u3057\u3001\u6e96\u5099\u3092\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306eif\u884c\u306f\u3001\u6b63\u3057\u304f\u51e6\u7406\u304c\u5b8c\u4e86\u3057\u305f\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3001\u554f\u984c\u304c\u3042\u308c\u3070\u30a8\u30e9\u30fc\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<p>sqlite3_bind_int \u306e\u884c\u306f\u3001\u5358\u7d14\u306b\uff1f\u30de\u30fc\u30af\u3068todo\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30d7\u30e9\u30a4\u30de\u30ea\u30fc\u30ad\u30fc\u3092\u7f6e\u304d\u63db\u3048\u3066\u3044\u307e\u3059\u3002\u3064\u307e\u308a\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u6587\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<blockquote><p>SELECT text FROM todo WHERE pk = 1;<br \/>\nSELECT text FROM todo WHERE pk = 2;<br \/>\nSELECT text FROM todo WHERE pk = 3;<br \/>\nSELECT text FROM todo WHERE pk = n;<\/p><\/blockquote>\n<p>\u305d\u306e\u5f8c\u306b the sqlite3_step(init_statement) \u30e1\u30bd\u30c3\u30c9\u304c\u547c\u3073\u51fa\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u4e0a\u3067SQL\u6587\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<p><span style=\"color: #888888;\">It is contained inside of an if statement to make sure it executed properly.<\/span><\/p>\n<p>\u3053\u308c\u3067\u3001\u3064\u3044\u306btodo\u30c7\u30fc\u30bf\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u6b21\u306e\u884c\u306b\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<blockquote><p>self.text = [NSString stringWithUTF8String:(char*) sqlite3_column_text(init_statement,0)];<\/p><\/blockquote>\n<p>\u3068\u3066\u3082\u9577\u3044\u4e00\u6587\u3067\u3059\u306d\u3002\u8a73\u3057\u304f\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>sqlite3_column_text \u30e1\u30bd\u30c3\u30c9\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u6587\u5b57\u5217\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53d6\u308a\u51fa\u3059\u3053\u3068\u3092SQL\u306b\u4f1d\u3048\u307e\u3059\u3002\u3053\u308c\u306f\uff12\u3064\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6301\u3063\u3066\u3044\u307e\u3059\u3002\u6700\u521d\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u3001\u4f7f\u7528\u3055\u308c\u3066\u3044\u308bSQL\u3078\u306e\u53c2\u7167\u3067\u3001\uff12\u3064\u76ee\u306f\u3001\u6587\u5b57\u5217\u3092\u53d6\u308a\u51fa\u3057\u305f\u3044\u30ab\u30e9\u30e0\u756a\u53f7\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306e\u30b1\u30fc\u30b9\u3067\u306f\u3001\uff11\u3064\u306e\u30ab\u30e9\u30e0\u3057\u304b\u6301\u305f\u306a\u3044\u305f\u3081\u3001\u300c\uff10\u300d\u3068\u3044\u3046\uff11\u3064\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3057\u304b\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u6b21\u306b\u3001(char *)\u306f\u3001\u6587\u5b57\u5217\u3078\u30ad\u30e3\u30b9\u30c8\u3057\u307e\u3059\u3002(\u4e0d\u8981\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u63a8\u5968\u3057\u307e\u3059\u3002)<\/p>\n<p>\u6700\u5f8c\u306b\u3001\u8fd4\u3055\u308c\u305f\u30c7\u30fc\u30bf\u306b\u3088\u308aNSString\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30d3\u30eb\u30c9\u3057\u3001\u305d\u308c\u3092 self.text\u306b\u5272\u308a\u5f53\u3066\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306b\u3001<strong>todoAppDelegate.h <\/strong>\u3092\u958b\u304d\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u7de8\u96c6\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<blockquote>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12e1b;\"><span style=\"color: #78492a;\">#import <\/span>&lt;UIKit\/UIKit.h&gt;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12e1b;\"><span style=\"color: #78492a;\">#import <\/span>&lt;sqlite3.h&gt;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"color: #bb2da2;\">@interface<\/span> todoAppDelegate : NSObject &lt;UIApplicationDelegate&gt; {<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa;\"><span style=\"color: #000000;\"> <\/span>UIWindow<span style=\"color: #000000;\"> *<\/span><span style=\"color: #4e8187;\">window<\/span><span style=\"color: #000000;\">;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa;\"><span style=\"color: #000000;\"> <\/span>UINavigationController<span style=\"color: #000000;\"> *<\/span><span style=\"color: #4e8187;\">navigationController<\/span><span style=\"color: #000000;\">;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span><span style=\"color: #703daa;\">sqlite3<\/span> *database;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span>NSMutableArray<span style=\"color: #000000;\"> *todos;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">}<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\">@property<span style=\"color: #000000;\"> (<\/span>nonatomic<span style=\"color: #000000;\">, <\/span>retain<span style=\"color: #000000;\">) <\/span>IBOutlet<span style=\"color: #000000;\"> UIWindow *window;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"color: #bb2da2;\">@property<\/span> (<span style=\"color: #bb2da2;\">nonatomic<\/span>, <span style=\"color: #bb2da2;\">retain<\/span>) <span style=\"color: #bb2da2;\">IBOutlet<\/span> UINavigationController *navigationController;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"color: #bb2da2;\">@property<\/span> (<span style=\"color: #bb2da2;\">nonatomic<\/span>, <span style=\"color: #bb2da2;\">retain<\/span>) NSMutableArray *todos;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\">@end<\/p>\n<\/blockquote>\n<p>NSMutableArray \u306etodo\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306f\u3001<a href=\"http:\/\/yamazon.org\/iphone-app-develop-tips\/658\">\u524d\u56de\u306e\u30d5\u30eb\u30fc\u30c4\u306e\u4f8b<\/a>\u306e\u3088\u3046\u306b\u3001todo\u30a2\u30a4\u30c6\u30e0\u3092\u64cd\u4f5c\u3059\u308b\u914d\u5217\u3067\u3059\u3002\u6700\u7d42\u7684\u306b\u306f\u3053\u306e\u914d\u5217\u3092\u3064\u304b\u3063\u3066\u3001UITableView\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u65b0\u3057\u304f\u3001<strong>sqlite3.h<\/strong> \u306e\u30a4\u30f3\u30dd\u30fc\u30c8\u6587\u3068\u00a0<strong>sqlite3 *database <\/strong>\u306e\u884c\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u3001<strong>todoAppDelegate.m<\/strong>\u3092\u958b\u304d\u3001\u3044\u304f\u3064\u304b\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<blockquote>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12e1b;\"><span style=\"color: #78492a;\">#import <\/span>&#8220;todoAppDelegate.h&#8221;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12e1b;\"><span style=\"color: #78492a;\">#import <\/span>&#8220;RootViewController.h&#8221;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #78492a;\">#import <span style=\"color: #d12e1b;\">&#8220;Todo.h&#8221;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"color: #bb2da2;\">@interface<\/span> todoAppDelegate (Private)<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">-(<span style=\"color: #bb2da2;\">void<\/span>)createEditableCopyOfDatabaseIfNeeded;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">-(<span style=\"color: #bb2da2;\">void<\/span>)initializeDatabase;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\">@end<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"color: #bb2da2;\">@implementation<\/span> todoAppDelegate<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\">@synthesize<span style=\"color: #000000;\"> window;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"color: #bb2da2;\">@synthesize<\/span> navigationController;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\">@synthesize<span style=\"color: #000000;\"> todos;<\/span><\/p>\n<\/blockquote>\n<p>\u3053\u3053\u3067\u306f\u65b0\u3057\u304f\u3001\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u306a\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u5ba3\u8a00\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u3053\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u7279\u6709\u306e\u3082\u306e\u306a\u306e\u3067\u3001.h \u30d5\u30a1\u30a4\u30eb\u3067\u5ba3\u8a00\u3059\u308b\u5fc5\u8981\u304c\u306a\u3044\u306e\u3067\u3001\u3053\u3053\u306b\u5ba3\u8a00\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u88c5\u3057\u305f\u4e8c\u3064\u306e\u6a5f\u80fd\u306f\u3001<strong>createEditableCopyOfDatabaseIfNeeded<\/strong> \u3068 <strong>initializeDatabase<\/strong>\u3067\u3059\u3002<\/p>\n<p>\u3053\u308c\u3089\u306e\u30b3\u30fc\u30c9\u306e\u5927\u90e8\u5206\u306f\u3001Apple\u306e SQLBooks \u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306b\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<blockquote>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">-(<span style=\"color: #bb2da2;\">void<\/span>)createEditableCopyOfDatabaseIfNeeded{<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span><span style=\"color: #bb2da2;\">BOOL<\/span> success;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span>NSFileManager<span style=\"color: #000000;\"> *fileManager = [<\/span>NSFileManager<span style=\"color: #000000;\"> <\/span><span style=\"color: #3d1e81;\">defaultManager<\/span><span style=\"color: #000000;\">];<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span><span style=\"color: #703daa;\">NSError<\/span> *error;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #3d1e81;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #703daa;\">NSArray<\/span><span style=\"color: #000000;\"> *paths = <\/span>NSSearchPathForDirectoriesInDomains<span style=\"color: #000000;\">(<\/span>NSDocumentDirectory<span style=\"color: #000000;\">, <\/span>NSUserDomainMask<span style=\"color: #000000;\">, <\/span><span style=\"color: #bb2da2;\">YES<\/span><span style=\"color: #000000;\">);<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #3d1e81;\"><span style=\"color: #000000;\"><br \/>\n<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span><span style=\"color: #703daa;\">NSString<\/span> *documentsDirectory = [paths <span style=\"color: #3d1e81;\">objectAtIndex<\/span>:<span style=\"color: #252bd8;\">0<\/span>];<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span><span style=\"color: #703daa;\">NSString<\/span> *writableDBPath = [documentsDirectory <span style=\"color: #3d1e81;\">stringByAppendingPathComponent<\/span>:<span style=\"color: #d12e1b;\">@&#8221;todo.sqlite&#8221;<\/span>];<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span>success = [fileManager <span style=\"color: #3d1e81;\">fileExistsAtPath<\/span>:writableDBPath];<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span><span style=\"color: #bb2da2;\">if<\/span>(success) <span style=\"color: #bb2da2;\">return<\/span>;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #3d1e81;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #703daa;\">NSString<\/span><span style=\"color: #000000;\"> *defaultDBPath = [[[<\/span><span style=\"color: #703daa;\">NSBundle<\/span><span style=\"color: #000000;\"> <\/span>mainBundle<span style=\"color: #000000;\">] <\/span>resourcePath<span style=\"color: #000000;\">] <\/span>stringByAppendingPathComponent<span style=\"color: #000000;\">:<\/span><span style=\"color: #d12e1b;\">@&#8221;todo.sqlite&#8221;<\/span><span style=\"color: #000000;\">];<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span>success = [fileManager <span style=\"color: #3d1e81;\">copyItemAtPath<\/span>:defaultDBPath <span style=\"color: #3d1e81;\">toPath<\/span>:writableDBPath <span style=\"color: #3d1e81;\">error<\/span>:&amp;error];<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span><span style=\"color: #bb2da2;\">if<\/span> (!success) {<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12e1b;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #78492a;\">NSAssert1<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #252bd8;\">0<\/span><span style=\"color: #000000;\">,<\/span>@&#8221;Failed to create writable database file with message &#8216;%@&#8217;.&#8221;<span style=\"color: #000000;\">,[error <\/span><span style=\"color: #3d1e81;\">localizedDescription<\/span><span style=\"color: #000000;\">]);<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span>}<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">}<\/p>\n<\/blockquote>\n<p>\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u304c\u672c\u8cea\u7684\u306b\u306f\u3057\u3066\u3044\u308b\u3053\u3068\u306f\u3001\u3042\u306a\u305f\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30d5\u30a9\u30eb\u30c0\u30fc\u304b\u3089\u3001iPhone\u4e0a\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30d5\u30a9\u30eb\u30c0\u30fc\u3078\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30b3\u30d4\u30fc\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u306f\u3001\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30d5\u30a9\u30eb\u30c0\u306b\u65e2\u306b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u5b58\u5728\u3059\u308b\u304b\u306e\u6700\u521d\u306e\u30c1\u30a7\u30c3\u30af\u6642\u306e\u307f\u767a\u751f\u3057\u307e\u3059\u3002<\/p>\n<p>\u95a2\u6570\u3084\u5909\u6570\u306e\u540d\u79f0\u304c\u3001\u3068\u3066\u3082\u7406\u89e3\u3057\u3084\u3059\u3044\u3088\u3046\u306b\u3001apple\u304c\u8a18\u8ff0\u3057\u3066\u304f\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u540d\u524d\u3092\u8ffd\u3063\u3066\u3044\u3051\u3070\u3001\u7406\u89e3\u3057\u3084\u3059\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306b<strong>initializeDatabase<\/strong>\u306e\u6a5f\u80fd\u3092\u5b9f\u88c5\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<blockquote>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">-(<span style=\"color: #bb2da2;\">void<\/span>)initializeDatabase{<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span>NSMutableArray<span style=\"color: #000000;\"> *todoArray = [[<\/span>NSMutableArray<span style=\"color: #000000;\"> <\/span><span style=\"color: #3d1e81;\">alloc<\/span><span style=\"color: #000000;\">] <\/span><span style=\"color: #3d1e81;\">init<\/span><span style=\"color: #000000;\">];<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span><span style=\"color: #bb2da2;\">self<\/span>.<span style=\"color: #4e8187;\">todos<\/span> = todoArray;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span>[todoArray <span style=\"color: #3d1e81;\">release<\/span>];<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #3d1e81;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #703daa;\">NSArray<\/span><span style=\"color: #000000;\"> *paths = <\/span>NSSearchPathForDirectoriesInDomains<span style=\"color: #000000;\">(<\/span>NSDocumentDirectory<span style=\"color: #000000;\">, <\/span>NSUserDomainMask<span style=\"color: #000000;\">, <\/span><span style=\"color: #bb2da2;\">YES<\/span><span style=\"color: #000000;\">);<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span><span style=\"color: #703daa;\">NSString<\/span> *documentsDirectory = [paths <span style=\"color: #3d1e81;\">objectAtIndex<\/span>:<span style=\"color: #252bd8;\">0<\/span>];<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span><span style=\"color: #703daa;\">NSString<\/span> *path = [documentsDirectory <span style=\"color: #3d1e81;\">stringByAppendingPathComponent<\/span>:<span style=\"color: #d12e1b;\">@&#8221;todo.sqlite&#8221;<\/span>];<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span> <span style=\"color: #bb2da2;\">if<\/span>(<span style=\"color: #3d1e81;\">sqlite3_open<\/span>([path <span style=\"color: #3d1e81;\">UTF8String<\/span>], &amp;<span style=\"color: #4e8187;\">database<\/span>) == <span style=\"color: #78492a;\">SQLITE_OK<\/span>){<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12e1b;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span> <\/span><span style=\"color: #bb2da2;\">const<\/span><span style=\"color: #000000;\"> <\/span><span style=\"color: #bb2da2;\">char<\/span><span style=\"color: #000000;\"> *sql = <\/span>&#8220;SELECT pk FROM todo&#8221;<span style=\"color: #000000;\">;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span> <span style=\"color: #703daa;\">sqlite3_stmt<\/span> *statement;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span> <span style=\"color: #bb2da2;\">if<\/span> (<span style=\"color: #3d1e81;\">sqlite3_prepare_v2<\/span>(<span style=\"color: #4e8187;\">database<\/span>, sql, &#8211;<span style=\"color: #252bd8;\">1<\/span>, &amp;statement, <span style=\"color: #bb2da2;\">NULL<\/span>) ==<span style=\"color: #78492a;\">SQLITE_OK<\/span>){<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span> <span style=\"color: #bb2da2;\">while<\/span> (<span style=\"color: #3d1e81;\">sqlite3_step<\/span>(statement) == <span style=\"color: #78492a;\">SQLITE_ROW<\/span>) {<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span> <span style=\"color: #bb2da2;\">int<\/span> primaryKey = <span style=\"color: #3d1e81;\">sqlite3_column_int<\/span>(statement, <span style=\"color: #252bd8;\">0<\/span>);<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span> <span style=\"color: #4e8187;\">Todo<\/span> *td = [[<span style=\"color: #4e8187;\">Todo<\/span> <span style=\"color: #3d1e81;\">alloc<\/span>] <span style=\"color: #31595e;\">initWithPrimaryKey<\/span>:primaryKey <span style=\"color: #31595e;\">database<\/span>:<span style=\"color: #4e8187;\">database<\/span>];<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span> [<span style=\"color: #4e8187;\">todos<\/span> <span style=\"color: #3d1e81;\">addObject<\/span>:td];<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span> [td <span style=\"color: #3d1e81;\">release<\/span>];<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span> }<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span> }<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span> <span style=\"color: #3d1e81;\">sqlite3_finalize<\/span>(statement);<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span> }<span style=\"color: #bb2da2;\">else<\/span>{<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #3d1e81;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span> <\/span>sqlite3_close<span style=\"color: #000000;\">(<\/span><span style=\"color: #4e8187;\">database<\/span><span style=\"color: #000000;\">);<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12e1b;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span> <\/span><span style=\"color: #78492a;\">NSAssert1<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #252bd8;\">0<\/span><span style=\"color: #000000;\">, <\/span>@&#8221;Failed to open database with message &#8216;%s&#8217;.&#8221;<span style=\"color: #000000;\">,<\/span><span style=\"color: #3d1e81;\">sqlite3_errmsg<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #4e8187;\">database<\/span><span style=\"color: #000000;\">));<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"white-space: pre;\"> <\/span> }<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">}<\/p>\n<\/blockquote>\n<p>\u305f\u304f\u3055\u3093\u306e\u8a18\u8ff0\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u304c\u3093\u3070\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\uff01<\/p>\n<p>\u6700\u521d\u306e\u884c\u306f\u3001<strong>NSMutableArray<\/strong>\u3092\u4f5c\u6210\u3057\u3001\u521d\u671f\u5316\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u79c1\u305f\u3061\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306etodos\u914d\u5217\u306b\u3053\u306e\u914d\u5217\u3092\u8a2d\u5b9a\u3057\u3066\u3001\u4e00\u6642\u7684\u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30ea\u30ea\u30fc\u30b9\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u6b21\u306e\uff13\u884c\u306f\u3001\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30d5\u30a9\u30eb\u30c0\u306e\u4e2d\u306b\u4f5c\u6210\u3055\u308c\u305f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u63a2\u3057\u307e\u3059\u3002<\/p>\n<p><strong>sqlite3_open<\/strong>\u306e\u884c\u306f\u3001\u30c7\u30fc\u30bf\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u3057\u307e\u3059\u3002\u6b63\u5e38\u306b\u63a5\u7d9a\u3055\u308c\u308c\u3070\u3001todo\u30a2\u30a4\u30c6\u30e0\u3092\u53d6\u308a\u51fa\u3057\u307e\u3059\u3002<\/p>\n<blockquote><p>const char *sql = &#8220;SELECT pk FROM todo&#8221;;<\/p><\/blockquote>\n<p>\u3053\u306e\u884c\u306f\u3001\u30d7\u30e9\u30a4\u30de\u30ea\u30fc\u30ad\u30fc\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306eSQL\u8a18\u8ff0\u3067\u3059\u3002<\/p>\n<p>Todo.m \u3067\u884c\u3063\u305f\u306e\u3068\u540c\u69d8\u306e\u8a18\u8ff0\u3092\u6e96\u5099\u3057\u307e\u3059\u3002\u30d7\u30e9\u30a4\u30de\u30ea\u30fc\u30ad\u30fc\u3092\u53d6\u5f97\u3059\u308b\u6761\u4ef6\u304c\u306a\u3044\u305f\u3081\u3001\u4eca\u56de\u306f\u201d\uff1f\u201d\u30de\u30fc\u30af\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u5358\u306b\u3001\u3059\u3079\u3066\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u4e0a\u306e\u30d7\u30e9\u30a4\u30de\u30ea\u30fc\u30ad\u30fc\u304c\u6b32\u3057\u3044\u3060\u3051\u306a\u306e\u3067\u3002<\/p>\n<p>while \u6587\u3067\u5404\u7d50\u679c\u304b\u3089\u30d7\u30e9\u30a4\u30de\u30ea\u30fc\u30ad\u30fc\u3092\u53d6\u308a\u51fa\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<blockquote><p>int primaryKey = sqlite3_column_int(statement,0);<\/p><\/blockquote>\n<p>\u3053\u308c\u306f\u3001Todo.m \u30af\u30e9\u30b9\u3067\u6587\u5b57\u5217\u3092\u53d6\u308a\u51fa\u3059\u306e\u306b\u3088\u304f\u4f3c\u3066\u3044\u307e\u3059\u3002<strong>sqlite3_column_text <\/strong>\u306e\u4ee3\u308f\u308a\u306b\u00a0<strong>sqlite3_column_int <\/strong>\u304c\u4f7f\u308f\u308c\u3066\u3044\u308b\u70b9\u3092\u304c\u9055\u3046\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u30d7\u30e9\u30a4\u30de\u30ea\u30fc\u30ad\u30fc\u3092\u53d6\u5f97\u3057\u305f\u5f8c\u3001<strong>initWithPrimaryKey <\/strong>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3092\u547c\u3073\u51fa\u3057\u3066\u3044\u307e\u3059\u3002\u30d7\u30e9\u30a4\u30de\u30ea\u30fc\u30ad\u30fc\u306f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u306e\u53c2\u7167\u3068\u3057\u3066\u6e21\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u6700\u7d42\u7684\u306b\u3001\u79c1\u305f\u3061\u306f\u65b0\u305f\u306b\u4f5c\u6210\u3055\u308c\u305fTodo\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092todos\u306e\u914d\u5217\u306b\u52a0\u3048\u307e\u3059\u3002<\/p>\n<p>\u6700\u5f8c\u306e\u3001<strong>sqlite3_finalize <\/strong>\u306f\u3001\u30e1\u30e2\u30ea\u3092\u89e3\u653e\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306e\u6700\u5f8c\u3068\u3057\u3066\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3057\u3001\u521d\u671f\u5316\u3059\u308b\u305f\u3081\u306b\u3001\u3053\u308c\u3089\u306e\u6a5f\u80fd\u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002<strong>applicationDidFinishLaunching<\/strong> \u306e\u7b87\u6240\u306b\u4ee5\u4e0b\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<blockquote>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">&#8211; (<span style=\"color: #bb2da2;\">BOOL<\/span>)application:(<span style=\"color: #703daa;\">UIApplication<\/span> *)application didFinishLaunchingWithOptions:(<span style=\"color: #703daa;\">NSDictionary<\/span> *)launchOptions {<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #31595e;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span>[<\/span><span style=\"color: #bb2da2;\">self<\/span><span style=\"color: #000000;\"> <\/span>createEditableCopyOfDatabaseIfNeeded<span style=\"color: #000000;\">];<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #31595e;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span>[<\/span><span style=\"color: #bb2da2;\">self<\/span><span style=\"color: #000000;\"> <\/span>initializeDatabase<span style=\"color: #000000;\">];<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #008400;\"><span style=\"color: #000000;\"> <\/span>\/\/ Override point for customization after application launch.<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #008400;\"><span style=\"color: #000000;\"> <\/span>\/\/ Add the navigation controller&#8217;s view to the window and display.<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4e8187;\"><span style=\"color: #000000;\"> [<\/span>window<span style=\"color: #000000;\"> <\/span><span style=\"color: #3d1e81;\">addSubview<\/span><span style=\"color: #000000;\">:<\/span>navigationController<span style=\"color: #000000;\">.<\/span><span style=\"color: #3d1e81;\">view<\/span><span style=\"color: #000000;\">];<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #3d1e81;\"><span style=\"color: #000000;\"> [<\/span><span style=\"color: #4e8187;\">window<\/span><span style=\"color: #000000;\"> <\/span>makeKeyAndVisible<span style=\"color: #000000;\">];<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\"><span style=\"color: #000000;\"> <\/span>return<span style=\"color: #000000;\"> <\/span>YES<span style=\"color: #000000;\">;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">}<\/p>\n<\/blockquote>\n<p>\u5358\u306b\u3001\u3053\u308c\u3089\u306e\u6a5f\u80fd\u3092\u547c\u3073\u51fa\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u4eca\u56de\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306f\u3001\u3053\u308c\u3067\u5b8c\u4e86\u3067\u3059\u304c\u3001\u3053\u306e\u72b6\u614b\u3067\u30d3\u30eb\u30c9\u3057\u3066\u5b9f\u884c\u3057\u3066\u3082\u3001\u4f55\u3082\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u30d6\u30ed\u30b0\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u9806\u306b\u8aad\u307f\u9032\u3081\u3066\u304f\u3060\u3055\u3063\u305f\u65b9\u306a\u3089\u3001\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u304c&#8230;<\/p>\n","protected":false},"author":1,"featured_media":690,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-681","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-old-blog"],"_links":{"self":[{"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/posts\/681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=681"}],"version-history":[{"count":0,"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/posts\/681\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=\/"}],"wp:attachment":[{"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}