2014年7月8日星期二

IOS - 应用的发布方式有哪些?

App Store Distribution: 最常用的, 需要Apple审核 
Ad-Hoc Distribution: 针对测试设备, 每个应用不能发不到超过100个设备上,发布前需要将每个设备的唯一编码打包进去 
Custom B2B App Distribution: 针对企业用户批量购买,可以进行打折等,仅限美国用户 
In-house Distribution: 针对企业内部用户发布的应用,需要企业开发者账号,然后通过itunes同步、iPhone配置工具、建立私有的应用安装网站等方式进行发布,不需要审核

2014年7月7日星期一

IOS Training - NS***

在IOS开发中,经常会遇到NS开头的对象,这个要从乔帮主历史恩怨说起。当年Steve Jobs 和John Scullery与恩怨,乔帮主当年被人挤兑出苹果,自立门户的时候做了个公司叫做NextStep,里面这一整套开发包很是让一些科学家们喜欢,而现在Mac OS用的就是NextStep这一套函数库。 

这些开发NextStep的人们比较自恋地把函数库里面所有的类都用NextStep的缩写打头命名,也就是NS****了。比较常见的比如: 
NSLog 
NSString 
NSInteger 
NSURL 
NSImage 
… 

你会经常看到一些教学里面会用到: 

NSLog (@"%d",myInt); 

这句话主要是在console里面跟踪使用,你会在console里面看到myInt的值(在XCode里面运行的时候打开dbg窗口即可看到)。 

你还可以看到其他名字打头的一些类,比如CF、CA、CG、UI等等,比如 

CFStringTokenizer 这是个分词的东东 
CALayer 这表示Core Animation的层 
CGPoint 这表示一个点 
UIImage 这表示iPhone里面的图片 

CF说的是Core Foundation,CA说的是Core Animation,CG说的是Core Graphics,UI说的是iPhone的User Interface……还有很多别的,等你自己去发掘了。 

2014年6月19日星期四

phonegap faq

phonegap building faq 

1.xcode-select 

fanfq-macbook:hello fanfangqing$ cordova -d platform add ios 
cordova library for "ios" already exists. No need to download. Continuing. 
Checking if platform "ios" passes minimum requirements... 
Creating ios project... 
Running command: /Users/fanfangqing/.cordova/lib/ios/cordova/3.5.0/bin/create --arc --cli /Users/fanfangqing/MyCode/fanfq-html54mobile/phonegap/hello/platforms/ios com.example.hello HelloWorld 
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
Cordova can only run in Xcode version 4.6 or greater.
 
Command finished with error code 2: /Users/fanfangqing/.cordova/lib/ios/cordova/3.5.0/bin/create --arc,--cli,/Users/fanfangqing/MyCode/fanfq-html54mobile/phonegap/hello/platforms/ios,com.example.hello,HelloWorld 
Error: /Users/fanfangqing/.cordova/lib/ios/cordova/3.5.0/bin/create: Command failed with exit code 2
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:755:16)
    at Process.ChildProcess._handle.onexit (child_process.js:822:5)
 
fanfq-macbook:hello fanfangqing$ cordova platform ls 

*由于最近新出了个swift的东东所以xcode4跟新到了xcode6beta;macos也从Lion直接跟新到Mavericks,跳过了Mountain Lion由于之前跟新到Mountain Lion要收费,作为很扣的我当然不愿意支付那笔费用,不过这次跟新到Mavericks是免费的,哈哈,窃喜一小下。 
fanfq-macbook:Applications fanfangqing$ sudo xcode-select --switch /Applications/Xcode6-Beta.app/Contents/Developer 

喵哩个咪的问题解决了,在google group中发邮件问题,有专家指出当前phonegap支持xcode最大的版本号是5.1,所以我之前安装的xcode6beta想尝鲜swift所以不得不换成老版本。 
/////////////////////////////////////////////////// 
for android 
fanfq-macbook:hello fanfangqing$ cordova platform add android 
Creating android project... 

/Users/fanfangqing/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:126 
                    throw e; 
                          ^ 
Error: ERROR : executing command 'ant', make sure you have ant installed and added to your path. 
    at /Users/fanfangqing/.cordova/lib/android/cordova/3.5.0/bin/lib/check_reqs.js:47:27 
    at ChildProcess.exithandler (child_process.js:651:7) 
    at ChildProcess.emit (events.js:98:17) 
    at maybeClose (child_process.js:755:16) 
    at Socket.<anonymous> (child_process.js:968:11) 
    at Socket.emit (events.js:95:17) 
    at Pipe.close (net.js:465:12) 
Error: /Users/fanfangqing/.cordova/lib/android/cordova/3.5.0/bin/create: Command failed with exit code 8 
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23) 
    at ChildProcess.emit (events.js:98:17) 
    at maybeClose (child_process.js:755:16) 
    at Process.ChildProcess._handle.onexit (child_process.js:822:5) 
fanfq-macbook:hello fanfangqing$ 

phonegap - CLI (Command-Line Interface)

喵哩个咪的! 
一年多不玩phonegap了,最近项目结束有空再次研究下;发现已经出了3.x版本了,虽然之前的2.0版本还可以使用做一些原型演示,但是发现出了个CLI的东东,貌似很牛逼的样子,经过尝试后发现各种问题,不过觉得这个东西还是很用的,一定要解决这些问题。另外写了篇文章讲诉了我在使用CLI中遇到的各种问题。 

CLI: 
http://docs.phonegap.com/en/edge/guide_cli_index.md.html#The%20Command-Line%20Interface 

2013年3月15日星期五

sfdc 常见问题

Date/DateTime/Timezone 
Object里面有个DateTime字段 
通过查询后取到该数据,显示在页面的时候发现居然与同事的数据不一样。 
eg. 原始数据 03/15/2013 但是同事显示的日期是正确的,而我显示的是 03/14/2013 
由于相差是一天第一感觉是时差问题,毕竟后台的数据,逻辑始终都是一样的,浏览器 操作系统都设置了下都没有用,突然我在想是不是profile的设置问题。 
然后就查看 setup》Personal Information 》里面的Time Zone属性。 
我的是 (GMT-07:00) Pacific Daylight Time (America/Los_Angeles),再看下同事的他的是 (GMT+08:00) China Standard Time (Asia/Shanghai)。原来问题就在这里SFDC拿数据库的时间也会根据当前用户的timezone 会去自动转换的,除非那个字段不是date,datetime类型. 

分页查询 
SELECT a FROM b LIMIT 10 offset 7 从第7行开始查询,查询数量为10。 

起始位从0开始。以后在原有基础上+10就可以完成分页查询了。

2013年3月8日星期五

Limited

21:07:51.686|LIMIT_USAGE_FOR_NS|(default)| 
  Number of SOQL queries: 0 out of 100 
  Number of query rows: 0 out of 50000 
  Number of SOSL queries: 0 out of 20 
  Number of DML statements: 0 out of 150 
  Number of DML rows: 0 out of 10000 
  Number of code statements: 5910 out of 200000//ver.14 已经没有这个limit了 
  Maximum heap size: 0 out of 6000000 
  Number of callouts: 0 out of 10 
  Number of Email Invocations: 0 out of 10 
  Number of fields describes: 0 out of 100 
  Number of record type describes: 0 out of 100 
  Number of child relationships describes: 0 out of 100 
  Number of picklist describes: 0 out of 100 
  Number of future calls: 0 out of 10

APEX LIB

{!IF(x.A_Type__c = 'abc','this is true','this is false')} 


<!-- date format --> 
<apex:outputText value="{0,date,MM/dd/yyyy}"> 
<apex:param value="{!d.Start_Date__c}" /> 
</apex:outputText> 

DateTime myDateTime = system.now(); 
String method1= myDateTime .format('MM/dd/yyyy'); 
Sting method2= myDateTime .month()+'/'+myDateTime .day()+'/'+myDateTime .year(); 


String abc = 'a,b,c'; 
abc.split('\\,');  //记得就加 \\ 


http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_outputText.htm