﻿{"id":1217,"date":"2014-06-06T19:49:59","date_gmt":"2014-06-06T11:49:59","guid":{"rendered":"http:\/\/nick.txtcc.com\/?p=1217"},"modified":"2014-06-06T19:49:59","modified_gmt":"2014-06-06T11:49:59","slug":"iphone%e5%a6%82%e4%bd%95%e6%89%93%e5%8c%85%e6%88%90%e4%b8%80%e4%b8%aa%e9%80%9a%e7%94%a8%e7%9a%84%e9%9d%99%e6%80%81%e5%ba%93%e6%96%87%e4%bb%b6%e6%a8%a1%e6%8b%9f%e5%99%a8%e5%92%8c%e7%9c%9f%e6%9c%ba","status":"publish","type":"post","link":"http:\/\/nick.txtcc.com\/index.php\/android-ios\/1217","title":{"rendered":"iPhone\u5982\u4f55\u6253\u5305\u6210\u4e00\u4e2a\u901a\u7528\u7684\u9759\u6001\u5e93\u6587\u4ef6(\u6a21\u62df\u5668\u548c\u771f\u673a\u90fd\u53ef\u4ee5\u7528)\uff1f"},"content":{"rendered":"<p>iPhone\u5982\u4f55\u6253\u5305\u6210\u4e00\u4e2a\u901a\u7528\u7684\u9759\u6001\u5e93\u6587\u4ef6(\u6a21\u62df\u5668\u548c\u771f\u673a\u90fd\u53ef\u4ee5\u7528)\uff1f <\/p>\n<p>\u6700\u8fd1\u5728\u505a\u4e00\u4e2a\u8d2d\u7968\u9879\u76ee\uff0c\u652f\u4ed8\u4e0e\u94f6\u8054\u5408\u4f5c\uff0c\u4ed6\u4eec\u63d0\u4f9b2\u4e2a.a\u7684\u9759\u6001\u5e93\u6587\u4ef6\uff0c\u4e00\u4e2a\u771f\u673a\u4f7f\u7528\uff0c\u4e00\u4e2a\u662f\u6a21\u62df\u5668\u4f7f\u7528\u3002\u4f46\u662f\u6bcf\u6b21\u771f\u673a\u6d4b\u8bd5\u7684\u65f6\u5019\uff0c\u90fd\u8981\u6362\u6210\u771f\u673a\u7684.a\u5e93\uff0c\u6a21\u62df\u5668\u6d4b\u8bd5\u7684\u65f6\u5019\u53c8\u8981\u6362\u56de\u6765\uff0c\u7279\u522b\u9ebb\u70e6\u3002\u4e00\u5929\u51e0\u5341\u6b21\u771f\u673a\u548c\u6a21\u62df\u5668\u6d4b\u8bd5\uff0c\u6765\u56de\u6298\u817e\u6d6a\u8d39\u4e86\u5f88\u591a\u65f6\u95f4\uff0c\u6211\u7ec8\u4e8e\u53d7\u4e0d\u4e86\uff0c\u7f51\u4e0a\u4e5f\u6ca1\u4e00\u4e2a\u5b8c\u6574\u7684\u89e3\u51b3\u65b9\u6848\uff0cgoogle\u4e86\u4e0b\u65b9\u6cd5\uff0c\u6700\u540e\u901a\u8fc7\u81ea\u5df1\u7684\u5b9e\u8df5\uff0c\u6210\u529f\u7684\u89e3\u51b3\u4e86.a\u9759\u6001\u5e93\u6587\u4ef6\u901a\u7528\u6027\u95ee\u9898\uff0c\u5e0c\u671b\u8fd9\u4e2a\u80fd\u7ed9\u5927\u5bb6\u5e26\u6765\u65b9\u4fbf\uff0c\u75db\u82e6\u7684\u7ae5\u978b\u4eec\uff0c\u53ef\u4ee5\u89e3\u8131\u4e86! <\/p>\n<p>1.\u5148\u6765\u4e00\u4e2a\u5fc5\u987b\u7684\u547d\u4ee4\uff1a\n~\/Library\u76ee\u5f55\u5728lion\u4e0b\u662f\u9ed8\u8ba4\u9690\u85cf\u7684\u3002\u8fd9\u6837\u5f88\u4e0d\u65b9\u4fbf\u3002\u7528\u4e00\u4e0b\u547d\u4ee4\u53ef\u4ee5\u4f7f\u5176\u663e\u793a\uff1a\nchflags nohidden ~\/Library\n\u5982\u679c\u60f3\u518d\u8ba9\u5176\u9690\u85cf\uff0c\u53ef\u4ee5\uff1a\nchflags hidden ~\/Library <\/p>\n<p>2.\u9759\u6001\u5e93\u5de5\u7a0b\u7684\u5efa\u7acb\uff1aXcode New\u4e00\u4e2a\u65b0\u7684project\uff0c\u9009\u62e9IOS\u4e0b\u9762\u7684Framework&#038;Library\uff0c\u4e0b\u9762\u6709\u4e00\u4e2aCocoa Touch Static Library\u3002\u76f4\u63a5next\u53bb\u5efa\u7acb\u4e00\u4e2aMtimeLibrary\u8fd9\u6837\u7684\u5de5\u7a0b\u3002(\u91cc\u9762\u7684\u529f\u80fd\u5c31\u4e0d\u8981\u5173\u6ce8\u4e86\uff0c\u7b80\u5355 2\u4e2a\u6570\u76f8\u52a0)\n\ufffc <\/p>\n<p>3.\u5de5\u7a0b\u5efa\u7acb\u4ee5\u540e\uff0c\u5220\u9664\u9ed8\u8ba4\u7684.h .m \u6587\u4ef6\uff0c\u7136\u540e\u81ea\u5df1\u521b\u5efaCountNumbers..h CountNumbers..m\u6587\u4ef6\u3002\u5982\u4e0b\u56fe\uff1a <\/p>\n<p>4.OK\uff0c\u9009\u62e9iPhone 5.1Simulator ,Command + B \u7f16\u8bd1\uff0c\u6211\u4eec\u53ef\u4ee5\u5728Products\u4e0b\u9762\u627e\u5230\u6211\u4eec\u7f16\u8bd1\u751f\u6210\u4e00\u4e2a\u6a21\u62df\u5668\u4e0a\u53ef\u8fd0\u884c\u7684libMtimeLibrary.a\u8fd9\u4e2a\u6587\u4ef6,\u7136\u540e\u9009\u62e9\u771f\u673a\uff08\u5982\u4e0b\u56fe\uff09\u518d\u7f16\u8bd1\u4e00\u6b21\uff0c\u8fd9\u6837\u4f1a\u751f\u6210\u4e00\u4e2a\u53ef\u4ee5\u771f\u673a\u8fd0\u884c\u7684libMtimeLibrary.a\u5e93\u3002 <\/p>\n<p>\ufffc <\/p>\n<ol start=\"5\">\n<li>\u5728libMtimeLibrary.a \u53f3\u952e Open in Finder\uff0c\u53ef\u4ee5\u627e\u5230libMtimeLibrary.a\u6240\u5728\u8def\u5f84\u3001\u540e\u9762\u6211\u4eec\u4f1a\u65b0\u5efa\u4e00\u4e2a\u9879\u76ee\u6765\u6dfb\u52a0\u8fd9\u4e2a.a\u6587\u4ef6\u6d4b\u8bd5\u3002 <\/li>\n<\/ol>\n<p>\u6253\u5f00\u7ec8\u7aef\uff1a\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff08\u8def\u5f84\u6839\u636e\u81ea\u5df1\u7684\u6765\u51b3\u5b9a\uff09\ncd  \/Users\/cash\/Library\/Developer\/Xcode\/DerivedData\/MtimeLibrary-amyqbnwwzcivnyeijggzaorseihj\/Build\/Products\/ <\/p>\n<p>\u8fd9\u6837\u5c31\u5230\u4e86Products\u76ee\u5f55\u4e0b\u4e86\uff0cls \u4ee5\u540e\u53ef\u4ee5\u770b\u5230\uff1a\n\ufffc <\/p>\n<p>\u518d\u8f93\u5165\u4e00\u4e2a\u547d\u4ee4\uff1a cd  Debug-iphonesimulator\/ <\/p>\n<p>\u7136\u540e\u901a\u8fc7\u4e0b\u9762\u547d\u4ee4\u6765\u67e5\u770blibMtimeLibrary.a\u4fe1\u606f\n\u547d\u4ee4\uff1alipo -info libMtimeLibrary.a\n\u663e\u793a\uff1a\ncashmatoMacBook-Pro:Debug-iphonesimulator cash$ lipo -info libMtimeLibrary.a\ninput file libMtimeLibrary.a is not a fat file\nNon-fat file: libMtimeLibrary.a is architecture: i386\ni386\u662fmac\u4e0a\u7684\u67b6\u6784\u3002 <\/p>\n<p>\u7136\u540e\u518d\u8f93\u5165\u4e0b\u9762\u547d\u4ee4\uff1a\ncd ..\/ <\/p>\n<p>cd   Debug-iphoneos\/ <\/p>\n<p>\u7ee7\u7eed\u901a\u8fc7\u547d\u4ee4\u6765\u67e5\u770b  lipo -info libMtimeLibrary.a\uff0c\n\u663e\u793a\uff1a\ncashmatoMacBook-Pro:Debug-iphoneos cash$ lipo -info libMtimeLibrary.a\ninput file libMtimeLibrary.a is not a fat file\nNon-fat file: libMtimeLibrary.a is architecture: armv7\narmv7\u662fiOS\u4e0a\u7684jia&#8217;ge\u67b6\u6784\u3002 <\/p>\n<p>\u5230\u8fd9\u91cc\u6211\u4eec\u4e5f\u660e\u767d\u4e86\uff0c\u4e3a\u4ec0\u4e48\u4e00\u4e2a\u5728\u771f\u673a\u4e0a\u53ef\u4ee5\u4f7f\u7528\uff0c\u4e00\u4e2a\u53ea\u80fd\u5728\u6a21\u62df\u5668\u4e0a\u4f7f\u7528\u4e86\u5427\uff01 <\/p>\n<p>\u6700\u540e\u6211\u4eec\u8981\u505a\u7684\u5c31\u662f\u8981\u8ba9\u8fd9\u4e2alibMtimeLibrary.a\u6587\u4ef6\u540c\u65f6\u6709i386\u548carmv7\u4fe1\u606f\uff0c\u8fd9\u6837\u5c31\u662f\u4e00\u4e2a\u901a\u7528\u7684\u9759\u6001\u5e93\u6587\u4ef6\u4e86\u3002 <\/p>\n<ol start=\"6\">\n<li>\u65b0\u5efa\u4e00\u4e2aMtimeLibraryDemo\u5e94\u7528\uff0c\u7136\u540e\u628a\u771f\u673a\u6216\u8005\u6a21\u62df\u5668\u7684libMtimeLibrary.a \u548cCountNumbers.h\u6587\u4ef6\u5f15\u5165\u8fdb\u6765\uff0c\u5982\u56fe\uff1a\n\ufffc <\/li>\n<\/ol>\n<p>\u6dfb\u52a0CountNumbers.h\u6587\u4ef6\u5230\u9700\u8981\u8c03\u7528\u7684\u7c7b\u91cc\u9762\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u8c03\u7528libMtimeLibrary.a\u91cc\u9762\u7684\u65b9\u6cd5\u4e86\u3002 <\/p>\n<p>\/\/\n\/\/  AppDelegate.m\n\/\/  MtimeLibraryDemo\n\/\/\n\/\/  Created by cash on 12-3-23.\n\/\/  Copyright (c) 2012\u5e74 <strong>MyCompanyName<\/strong>. All rights reserved.\n\/\/ <\/p>\n<p>#import &#8220;AppDelegate.h&#8221;\n#import &#8220;CountNumbers.h&#8221;\n@implementation AppDelegate <\/p>\n<p>@synthesize window = _window; <\/p>\n<ul>\n<li>\n<p>(void)dealloc\n{\n[_window release];\n[super dealloc];\n} <\/p>\n<\/li>\n<li>\n<p>(BOOL)application:(UIApplication <em>)application didFinishLaunchingWithOptions:(NSDictionary <\/em>)launchOptions\n{\nself.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];\n\/\/ Override point for customization after application launch. <\/p>\n<p>CountNumbers *cn = [[CountNumbers alloc] init];\nint count = [cn addTwoNumbers:10 :20];\nNSLog(@&#8221;count:%d&#8221;,count); <\/p>\n<p>self.window.backgroundColor = [UIColor whiteColor];\n[self.window makeKeyAndVisible];\nreturn YES;\n} <\/p>\n<\/li>\n<\/ul>\n<ol start=\"7\">\n<li>OK\uff0c\u7f16\u8bd1\u8fd0\u884c\u8fd9\u4e2a\u5e94\u7528\u7a0b\u5e8f\u3002 \u9519\u8bef\u4e86\u3002\u3002\u8fd9\u4e2a\u5c31\u662f\u8fd9\u7bc7\u6587\u6863\u7684\u5173\u952e\u4e86. <\/li>\n<\/ol>\n<p>\ufffc <\/p>\n<p>\u6211\u4eec\u627e\u5230\u521a\u624d\u751f\u6210\u771f\u673a\u548c\u6a21\u62df\u5668\u7684libMtimeLibrary.a\u76ee\u5f55\u3002\ndebug-iphoneos\u91cc\u9762\u7684\u662f\u57fa\u4e8earm6 arm7\u7f16\u8bd1\u51fa\u6765\u7684\u5e93\u6587\u4ef6\u3002debug-iphonesimulator\u6587\u4ef6\u5939\u4e0b\u9762\u7684\u662f\u57fa\u4e8ei386\u7f16\u8bd1\u51fa\u6765\u7684\u6587\u4ef6\u3002 <\/p>\n<p>\ufffc <\/p>\n<ol start=\"10\">\n<li>\u6700\u540e\u662f\u5173\u952e\u6b65\u9aa4\uff1a <\/li>\n<\/ol>\n<p>\u901a\u8fc7lipo -create \u547d\u4ee4\u6765\u5408\u5e762\u4e2a\u9759\u6001\u5e93\u6587\u4ef6\u3002\uff08-output \u540e\u9762\u7684\/Users\/cash\/Desktop\/test\/libMtimeLibrary.a \u662f\u5408\u5e76\u540e\u7684\u8def\u5f84\u548c\u6587\u4ef6\u540d\u5b57\uff09 <\/p>\n<p>lipo -create &#8220;\/Users\/cash\/Library\/Developer\/Xcode\/DerivedData\/MtimeLibrary-amyqbnwwzcivnyeijggzaorseihj\/Build\/Products\/Debug-iphonesimulator\/libMtimeLibrary.a&#8221; &#8220;\/Users\/cash\/Library\/Developer\/Xcode\/DerivedData\/MtimeLibrary-amyqbnwwzcivnyeijggzaorseihj\/Build\/Products\/Debug-iphoneos\/libMtimeLibrary.a&#8221; -output &#8220;\/Users\/cash\/Desktop\/test\/libMtimeLibrary.a&#8221;<br \/>\n\u6210\u529f\uff01 <\/p>\n<p>\u6700\u540e\u901a\u8fc7\u547d\u4ee4 lipo -info libMtimeLibrary.a  \u53ef\u4ee5\u77e5\u9053\u8fd9\u4e2a\u6587\u4ef6\u5df2\u7ecf\u6709i386\u548carmv7\u4fe1\u606f\u4e86\u3002\ncashmatoMacBook-Pro:test cash$ lipo -info libMtimeLibrary.a\nArchitectures in the fat file: libMtimeLibrary.a are: i386 armv7\ncashmatoMacBook-Pro:test cash$ <\/p>\n<p>\/\/\u94f6\u8054\u5408\u5e76\u6210\u901a\u7528\u9759\u6001\u5e93\nlipo -create &#8220;\/Users\/cash\/Desktop\/iphonesimulator\/upomp_bypay\/lib\/libUPOMP.a&#8221; &#8220;\/Users\/cash\/Desktop\/iphoneos\/upomp_bypay\/lib\/libUPOMP.a&#8221; -output &#8220;\/Users\/cash\/Desktop\/test\/libUPOMP.a&#8221;   <\/p>","protected":false},"excerpt":{"rendered":"<p>iPhone\u5982\u4f55\u6253\u5305\u6210\u4e00\u4e2a\u901a\u7528\u7684\u9759\u6001\u5e93\u6587\u4ef6(\u6a21\u62df\u5668\u548c\u771f\u673a\u90fd\u53ef\u4ee5\u7528)\uff1f \u6700\u8fd1\u5728\u505a\u4e00\u4e2a\u8d2d\u7968\u9879\u76ee\uff0c\u652f\u4ed8\u4e0e\u94f6\u8054\u5408\u4f5c\uff0c\u4ed6\u4eec\u63d0\u4f9b2\u4e2a.a\u7684\u9759\u6001\u5e93\u6587\u4ef6\uff0c\u4e00\u4e2a\u771f\u673a\u4f7f\u7528\uff0c\u4e00\u4e2a\u662f\u6a21\u62df\u5668\u4f7f\u7528\u3002\u4f46\u662f\u6bcf\u6b21\u771f\u673a\u6d4b\u8bd5\u7684\u65f6\u5019\uff0c\u90fd\u8981\u6362&#46;&#46;&#46;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[380],"tags":[382,383],"class_list":["post-1217","post","type-post","status-publish","format-standard","hentry","category-android-ios","tag-ios","tag-383"],"_links":{"self":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/1217","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/comments?post=1217"}],"version-history":[{"count":1,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/1217\/revisions"}],"predecessor-version":[{"id":1218,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/1217\/revisions\/1218"}],"wp:attachment":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/media?parent=1217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/categories?post=1217"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/tags?post=1217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}