說明:
EGL
原本是
"Embedded-System Graphic Library"
故EAGL
可解釋成
Embedded-System Apple Graphics Library所以openGL ES
應該可解釋成
openGL Embedded-System
As always , if you have any question , feel free to contact me.
有任何問題,請聯絡我
歡迎轉載,請註明出處,感謝。
What's the main difference between the armv7 and armv7s architecture targets for the LLVM C compiler? The presence of VFPv4 support. The armv7s target supports it, the v7 target doesn't. Why does this matter?或許你會想瞭解ARM(進階精簡指令集機器Advanced RISC Machine) - (浮點處理器)
#import <FacebookSDK/FacebookSDK.h>
extern NSString *const FBSessionStateChangedNotification;
NSString *const FBSessionStateChangedNotification =
@"com.example.Login:FBSessionStateChangedNotification";
/*
* Callback for session changes.
*/
- (void)sessionStateChanged:(FBSession *)session
state:(FBSessionState) state
error:(NSError *)error
{
switch (state) {
case FBSessionStateOpen:
if (!error) {
// We have a valid session
NSLog(@"User session found");
}
break;
case FBSessionStateClosed:
case FBSessionStateClosedLoginFailed:
[FBSession.activeSession closeAndClearTokenInformation];
break;
default:
break;
}
[[NSNotificationCenter defaultCenter]
postNotificationName:FBSessionStateChangedNotification
object:session];
if (error) {
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Error"
message:error.localizedDescription
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
}
/*
* Opens a Facebook session and optionally shows the login UX.
*/
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
return [FBSession openActiveSessionWithReadPermissions:nil
allowLoginUI:allowLoginUI
completionHandler:^(FBSession *session,
FBSessionState state,
NSError *error) {
[self sessionStateChanged:session
state:state
error:error];
}];
}
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI;
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"email",
@"user_likes",
nil];
return [FBSession openActiveSessionWithReadPermissions:permissions
allowLoginUI:allowLoginUI
completionHandler:^(FBSession *session,
FBSessionState state,
NSError *error) {
[self sessionStateChanged:session
state:state
error:error];
}];
}
reauthorizeWithPermissions:defaultAudience:completionHandler:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
// attempt to extract a token from the url
return [FBSession.activeSession handleOpenURL:url];
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
[FBSession.activeSession handleDidBecomeActive];
}
- (void)applicationWillTerminate:(UIApplication *)application
{
[FBSession.activeSession close];
}
#import "AppDelegate.h"
- (void)authButtonAction
{
AppDelegate *appDelegate =
[[UIApplication sharedApplication] delegate];
// If the user is authenticated, log out when the button is clicked.
// If the user is not authenticated, log in when the button is clicked.
if (FBSession.activeSession.isOpen) {
[appDelegate closeSession];
} else {
// The user has initiated a login, so call the openSession method
// and show the login UX if necessary.
[appDelegate openSessionWithAllowLoginUI:YES];
}
}
- (void) closeSession {
[FBSession.activeSession closeAndClearTokenInformation];
}
2.在delegate.h中- (void) closeSession;
- (void)authButtonAction
{
AppDelegate *appDelegate =
[[UIApplication sharedApplication] delegate];
// If the user is authenticated, log out when the button is clicked.
// If the user is not authenticated, log in when the button is clicked.
if (FBSession.activeSession.isOpen) {
[appDelegate closeSession];
} else {
// The user has initiated a login, so call the openSession method
// and show the login UX if necessary.
[appDelegate openSessionWithAllowLoginUI:YES];
}
}
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(sessionStateChanged:)
name:FBSessionStateChangedNotification
object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self];
- (void)sessionStateChanged:(NSNotification*)notification {
if (FBSession.activeSession.isOpen) {
[self.authButton setTitle:@"Logout" forState:UIControlStateNormal];
} else {
[self.authButton setTitle:@"Login" forState:UIControlStateNormal];
}
}
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; [appDelegate openSessionWithAllowLoginUI:NO];
#include <sys/xattr.h>
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
const char* filePath = [[URL path] fileSystemRepresentation];
const char* attrName = "com.apple.MobileBackup";
u_int8_t attrValue = 1;
int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
return result == 0;
}
Introduction
對於您將投入您的人力和時間去開發ios的應用程式,我們感到非常榮幸。無論是專業技術和財務上,此篇文章對於在數以萬計的開發者,都是非常有幫助的,我們希望能藉由此文章,順利幫助您加入這個成功的團隊。
apple團隊公佈的 App Store Review Guidelines 希望能帶領你快速的避開可能發生的問題和疑惑,加速批准您所提交的應用程式。
apple認為應用程式不同於書籍和音樂。若妳想批評宗教理念,或許妳應該去寫本真正的書。若你要討論性或者寫歌,或者醫藥的app。或許這有點繁瑣,但apple決定不允許這類型內容的app於app store上架。
請牢記下列原則,將會對你有所幫助:最後,我們非常珍愛,且以你的作品為榮,為了你的作品,我們真心將平台做到全世界最好,在這裡你可以大展才華,且以此賺取利潤。 或許這些原則聽起來像個控制狂,或許是,但因為我們承諾我們的用戶,在apple的設備上確保他們的產品品質和最佳體驗,就像你也如此的希望。 Table of Contents
- 條款與細則
- 功能性
- 數據資料、評價級數和排行榜
- 定位系統
- 推撥通知
- 遊戲中心
- iAD(apple提供開發者放置廣告的平台)
- 商標和商業外觀
- 多媒體內容
- 用戶界面
- 購買和貨幣
- web頁面的收集和整合
- 損壞設備
- 人身攻擊
- 暴力
- 令人反感的內容
- 隱私
- 色情
- 宗教、文化和種族
- 競賽(賭博、抽獎和彩卷)
- 慈善機構和捐助
- 法律上所要求事項
1.條款和細則作為一個app store的開發者,你受限於以下條款:Program License Agreement (PLA) 、 Human Interface Guidelines (HIG) ,還有其他與apple簽訂的證書和協議。下列規則和範例,將幫助你的app獲得認可,而非修正或者取代其他簽訂的協議規定。
2.功能性3.數據資料、評價級數和排行榜
- 2.1 崩潰的程序將被拒絕。
- 2.2 存在明顯bug的app會被拒絕
- 2.3 不符合開發者描述的app會被拒絕
- 2.4 在審核的過程中,app的內容描述與包含未公開的且隱藏性的功能不一致,將被拒絕
- 2.5 app使用非公開的APIs將被拒絕
- 2.6 app讀取或寫入資料超出其指定的容器區域將被拒絕
- 2.7 app試圖以任何方式或者形式下載代碼,將被拒絕
- 2.8 app安裝或者執行其他可執行的代碼,將被拒絕
- 2.9 任何以 ”beta”、”demo”、”trial”,or ”test” 為名的版本,將被拒絕
- 2.10 iphone apps無須加任何修改的在ipad運行,於iphone解析度和兩倍的iphone 3GS解析度下
- 2.11 在app store中重複的app可能會被拒絕,特別是如果有很多的放屁、打嗝、手電筒和愛經的app
- 2.12 沒有用處的app,還有與簡單的web界面組合在一起的app,或者沒有提供任何持續性娛樂價值的app(譁眾取寵的app或者無聊的app),將被拒絕
- 2.13 僅為市場推廣或廣告的app,將被拒絕
- 2.14 意圖提供某種把戲或虛假的功能,並未清楚標示,將被拒絕
- 2.15 app大於20MB 將無法於 蜂巢式網路(3g) 下載(app store將會自動處理)
- 2.16 多任務的app只能使用下列行為去執行後台運行: VoIP,音頻播放,地理位置,任務記錄,本地提醒等。
- 2.17 app訪問web頁面,必須使用iOS WebKit Framework 和 WebKit Javascript
- 2.18 鼓勵酗酒、違法藥物,誘導未成年人飲酒、吸煙,將被拒絕
- 2.19 提供錯誤訊息或其他不准確的設備資料,將被拒絕
- 2.20 通過許多版本的類似應用對App Store造成干擾的開發者會被取消IDP身份。
- 2.21 僅僅是一首歌曲或者電影的app,應該提交到iTunes store。若唯一本書,則應提交到iBook store
- 2.22 於app中,隨意的透過定位或者某些設備,企圖限制用戶使用app,將被拒絕
- 2.23 app必須遵循 iOS Data Storage Guidelines(中譯) ,否則將被拒絕
- 2.24 在Newsstand(書報亭、報攤)提供的應用程序,必須符合附表1,第2和第3的DeveloperProgram許可協議,否則將被拒絕
4.定位系統
- 3.1 app中提到其他任意移動平台,將被拒絕
- 3.2 app中有 placeholder text ,將被拒絕 (描述的功能就必須實現,如有些功能寫出來但還沒實現,或app跟描述有較大偏差)
- 3.3 app中描述不相關的內容和功能,將被拒絕
- 3.4 app在iTunes Connect和device中顯示的名稱應該相似,否則會造成混淆
- 3.5 不同尺寸的icons 必須相似,否則會造成混淆
- 3.6 app的 app icons 和 screenshots 不遵守4+年齡級距,將被拒絕
- 3.7 app的類別和類型的選擇與其內容並不相關,將被拒絕
- 3.8 開發人員對於自己的app選擇適當的評級,不適當的評級,將被拒絕
- 3.9 開發人員對於自己的app選擇適當的關鍵字,不適當的關鍵字,將被拒絕
- 3.10 通過偽造,付費評價或其他非正規手段,獲取App Store中較好的評價與星級的開發者會被取消IDP身份。
- 3.11 任何提示用戶需重新啓動iOS device來安裝或運行的app,將被拒絕
- 3.12 app在提交審核過程中,所有涉及到的URL都要處於正常運行狀態,例如保密協議,相關支持頁面等。
5.推撥通知
- 4.1 app並無通知用戶且獲得用戶同意下,收集、傳遞或者使用位置資料數據,將被拒絕
- 4.2 app使用 location-based 自動或自主去控制車輛、飛行器或其他裝置,將被拒絕
- 4.3 app使用 location-based 用於調度、車隊管理、緊急服務等,將被拒絕
- 4.4 位置資料只能用於app提供的直接相關功能或服務,或者有授權的廣告。
6.遊戲中心
- 5.1 app提供推撥通知,但並非使用app所提供的api,將被拒絕。
- 5.2 app使用APN (Apple Push Notification) 伺服器,並無從apple獲取Push Application ID 的app,將被拒絕。
- 5.3 app寄送APN時並無取得用戶的允許,將被拒絕。
- 5.4 app利用APN寄送敏感的私人資料或者機密資訊,將被拒絕。
- 5.5 app利用APN寄送未經請求的訊息,或以發垃圾郵件、網路釣魚為目的APN,將被拒絕。
- 5.6 app不得利用APN寄送廣告、活動或任何形式的直接推廣方式。
- 5.7 app不可提供收費使用的APN。
- 5.8 過度使用APN服務,佔用網路頻寬或容量或通過APN大量佔用系統資源的app,將被拒絕。
- 5.9 利用APN傳送病毒、文件、電腦代碼或程式,可能損害或破壞APN伺服器正常運行的app,將被拒絕。
7.iAD
- 6.1 向終端用戶或第三方展示Player ID的應用會被拒。
- 6.2 Player ID被用於Game Center條款款意外的用途的應用會被拒。
- 6.3 試圖通過Game Center反查,跟蹤,描述,關聯,發掘,收割,或利用Player ID,別名或其他信息的開發者會被取消IDP身份。
- 6.4 Game Center信息,例如Leaderboard得分,只能通過Game Center用於應用中。
- 6.5 使用Game Center發送主動消息,欺騙或干擾信息的應用會被拒。
- 6.6 使用Game Center過度佔用網絡帶寬或容量的應用會被拒。
- 6.7 傳輸病毒,文件,代碼或程序,導致破壞或擾亂正常的Game Center操作,的應用會被拒。
8.商標和商業外觀
- 7.1 人為增加曝光次數或點擊次數,將被拒絕
- 7.2 含有空的廣告橫幅,將被拒絕
- 7.3 設計主要用來展示廣告的app,將被拒絕
9.多媒體內容
- 8.1 app必須以下遵守所有的條款和條件的解釋: Guidelines for Using Apple Trademarks and Copyrights and the Apple Trademark List
- 8.2 任何誤導或暗示Apple為該應用來源或提供商,或Apple以任何形式認可其質量或功能的應用會被拒。
- 8.3 出現任何與現存apple product或廣告議題相似或混淆的app,將被拒絕。
- 8.4 app名稱中出現錯誤的蘋果產品的拼寫(如,GPS for Iphone,iTunz),將被拒絕。
- 8.5 使用受保護的第三方資源(商標,版權,商業機密,以及其他私有內容),請提供一份文本形式的使用授權。
- 8.6 app經由Google Maps API獲得的google maps和google earth圖像,其品牌特徵和原本的內容均須保持不變且為明顯可見,任何覆蓋或者修改google標誌或版權所有人的識別,將被拒絕。
10.用戶界面
- 9.1 app在不使用MediaPlayer framework的情況下,去存取音樂資料庫的媒體,將被拒絕
- 9.2 app使用者界面摹仿任何iPod界面,將被拒絕
- 9.3 通過蜂窩網絡傳輸的媒體音頻內容不得超過5MB或超過5分鐘。
- 9.4 通過蜂窩網絡傳輸超過10分鐘的媒體視頻內容,必須使用HTTP Live Streaming,並包含一條基線64kbps的音頻HTTP Live stream。
11.購買和貨幣
- 10.1 app必須遵守所有已解釋的條款和條件: Apple iOS Human Interface Guidelines
- 10.2 app外觀和於iPhone上自帶的app相似,包含App Store, iTunes Store, and iBookstore,將被拒絕
- 10.3 不按照Apple iOS Human Interface Guidelines中的描述正確使用系統控件的應用會被拒。
- 10.4 試圖創建備用桌面/主屏環境或模擬multi-app widget經驗的app,將被拒絕。
- 10.5 修改硬件開關標準功能(例如:音量,震動)的應用會被拒。
- 10.6 蘋果公司和我們的用戶都非常期待app擁有簡單、精緻、富創造性和深思熟慮的用戶體驗界面,做到這些必須付出非常大的努力,但卻很值得。apple對於此設置了很高的門檻。若你的使用者介面過於複雜或者不夠好,將被拒絕。
12.web界面的收集與整合
- 11.1 app以透過其他方法,非經由app store以外的方法解鎖或開啓額外特徵或功能,將被拒絕。
- 11.2 app透過非 In App Purchase API(IAP) 的功能購買內容、功能或者服務,將被拒絕。
- 11.3 app透過IAP購買與應用程式無關的實體商品、產品和服務,將被拒絕。
- 11.4 app透過IAP購買信貸或其他貨幣,必須在app中消費使用。
- 11.5 app透過IAP購買已過期的信貸或其他貨幣,將被拒絕
- 11.6 使用IAP收費訂閱的內容至少要在7天內有效,而且允許在所有iOS設備間共享。
- 11.7 用到IAP收費項目的應用必須分派到正確的收費類目中。
- 11.8 使用IAP向用戶收費以獲取iOS內建功能(如攝像頭,陀螺儀)的應用會被拒。
- 11.9 app含有『出租』內容或會在限定時間內到期的服務,將被拒絕。
- 11.10 保險類的app必須是免費的,須遵守發佈地區的法律,且不能使用IAP。
- 11.11 一般來說,越貴的app,審核就會越仔細。
- 11.12 提供收費訂閱的app必須使用IAP,Apple將會按照Developer Program License Agreement中約定的70/30的比例與開發者分賬。
- 11.13 app中如果提供了IAP以外的收費或訂閱機制,如:“buy”按鈕,跳轉到一個購買電子書的web頁面,將被拒絕。
- 11.14 app能閱讀和播放已有授權的內容(如:雜誌、新聞、書籍、影音),這些內容可容許非由此app購買或訂閱,只要那些須購買的授權內容並非經由app中的按鈕或者外部連結等方法。蘋果公司將不接受於app外訂閱或購買的授權項目任何部份的收入。
13.損壞設備
- 12.1 從Apple的頁面(如:apple.com, iTunes Store, App Store, iTunes Connect, Apple Developer Programs, 等)抓取內容,或利用Apple頁面和服務中的內容進行排名,將被拒絕。
- 12.2 應用可以使用授權的Apple RSS,例如iTunes Store RSS。
- 12.3 簡單的web頁面裁剪,內容整合或鏈接收集,將被拒絕。
14.個人攻擊
- 13.1 app鼓勵用戶去使apple device損壞的行為,將被拒絕
- 13.2 快速耗光設備電力或產生大量熱量,將被拒絕。
15.暴力
- 14.1 任何涉嫌誹謗,侮辱,狹隘內容或打擊個人或團體,將被拒絕。
- 14.2 職業為政治諷刺家和幽默作家不受該條款約束。
16.不良內容
- 15.1 展示人或動物被殺戮,致殘,槍擊,針刺或其他傷害的真實圖片,將被拒絕。
- 15.2 描述暴力或虐待兒童,將被拒絕。
- 15.3 遊戲中的“敵人”不能單獨的設定為某特定比賽,文化,真實的政府或組織,或者任何現實事物。
- 15.4 含有以鼓勵非法或魯莽使用的方式描述真實武器,將被拒絕。
- 15.5 帶有俄羅斯輪盤的賭博遊戲,將被拒絕。
17.隱私
- 16.1 app呈現過於令人反感或粗糙的內容,將被拒絕。
- 16.2 設計來惹怒或惡心用戶的應用會被拒。
18.色情
- 17.1 app不得在用戶未經許可的情況下傳送用戶資料,且必須提供用戶將何處及如何被使用這些資訊。
- 17.2 app因某些功能而要求用戶分享個資,如:email、地址、生日,將被拒絕。
- 17.3 專門收集未成年人的資料,將被拒絕。
19.宗教、文化與總族
- 18.1 app含有色情內容,韋氏詞典中有“定義明確的描述或顯示性器官或活動,旨在刺激,而不是審美情感和情緒的色情”,將被拒絕。
- 18.2 app中經常有用戶提供色情內容(例如:Chat Roulette apps),將被拒絕。
20.競賽(賭博、抽獎和彩卷)
- 19.1 帶有對一種信仰,文化或種族進行誹謗,侮辱,狹隘,或以他們為目標的暴力或傷害內容的應用會被拒。
- 19.2 應用若帶有或應用對一種信仰的文字描述,那麼這個引用或翻譯必須是精確,無歧義的。注釋內容可以具有教育性,信息性,但不可以為煽動性。
21.慈善機構與捐助
- 20.1 賭博和競賽必須是由應用開發者或所有公司發起的。
- 20.2 應用中必須展示賭博和競賽的官方條款,並聲明Apple不是發起者,並且在任何情況下與此事無關。
- 20.3 開發者必須經過法律允許才能上線一款抽奬應用,而且抽奬應用必須具備以下要素:報酬,機會,和奬金。
- 20.4 直接允許用戶在應用中購買彩票或抽奬的應用會被拒。
22.法律上所要求事項
- 21.1 含有向已認證的慈善機構捐助功能的應用必須是免費的。
- 21.2 慈善募捐必須通過短信息或通過Safari訪問web頁面完成。
Living document
- 22.1 應用必須遵守所有發佈地區當地法律。開發者有義務瞭解和遵守各地的法律。
- 22.2 任何帶有虛假,欺詐和帶有歧義的描述的應用會被拒。
- 22.3 任何召集,推銷和股東犯罪和魯莽行為的應用會被拒。
- 22.4 非法文件共享應用會被拒。
- 22.5 任何設計用來非法賭博,包括算牌,的應用會被拒。
- 22.6 提供匿名電話或短消息/彩信功能的應用會被拒。
- 22.7 任何開發暗中獲取用戶密碼和私有數據的開發者會被取消IDP身份。
- 22.8 任何非法律執行部門發佈的帶有DUI檢查點信息,或鼓勵且協助酒後駕車的應用會被拒。
此Guidelines代表我們盡最大的努力,分享我們如何審查提交到app store的app,我們希望這文件對於您app的開發和上傳審核是一個有用的指南。這是一個會變更的文件(動態文檔),因新的應用程式會有新的狀況,此文件將會定期更新,以反應這些新的變化狀況。感謝您致力於開發iOS。雖然這份文檔是告訴開發者什麼不該越矩的一份艱鉅列表,但也同時謹記該做的那份更短的列表。更重要的是,加入我們並試著帶給用戶驚奇和喜悅。展示世界最具創意的方式給用戶,並讓用戶體驗前所未有的生活方式。根據我們的經驗,用戶真的會對功能和界面的改善有所反應。好事多磨,給予用戶超出他們所期待的,帶給用戶前所未有的體驗。我們蓄勢待發的等待您隨時需要我們協助的時候。© Apple, 2012
application:didFinishLaunchingWithOptions: method to retrieve information about the URL and decide whether you want to open it. This method is called only when your app is launched.application:openURL:sourceApplication:annotation: method to open the file.application:handleOpenURL: method to open the file.<scheme>://<net_loc>/<path>;<params>?<query>#<fragment>
NSURL *url = [NSURL URLWithString: @"http://some-site.com:999/dir1/dir2;param?field-1=value-1&field-2=value-2#anchor1"]; NSLog(@"Scheme: %@", [url scheme]); NSLog(@"Host: %@", [url host]); NSLog(@"Port: %@", [url port]); NSLog(@"Path: %@", [url path]); NSLog(@"Relative path: %@", [url relativePath]); NSLog(@"Path components as array: %@", [url pathComponents]); NSLog(@"Parameter string: %@", [url parameterString]); NSLog(@"Query: %@", [url query]); NSLog(@"Fragment: %@", [url fragment]);
//使用下方的語法,就可以透過你的app去呼叫外部的應用程式,但前提是必須取得外部應用程式的URL Scheme,才可以呼叫得到。 NSURL *myURL = [NSURL URLWithString:@"todolist:"]; //『todolist』就是外部app的URL Scheme [[UIApplication sharedApplication] openURL:myURL];
-fno-objc-arc 指令的使用。#import <Twitter/Twitter.h> #import <Accounts/Accounts.h> @property (strong, nonatomic) ACAccountStore *accountStore; @property (strong, nonatomic) NSArray *accounts; @synthesize accounts = _accounts; @synthesize accountStore = _accountStore;
#pragma mark - login
- (void)login_twitter
{
[self fetchData];
}
- (void)fetchData
{
if (_accounts == nil)
{
if(_accountStore == nil)
{
self.accountStore = [[ACAccountStore alloc] init];
}
ACAccountType *accountTypeTwitter = [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[self.accountStore requestAccessToAccountsWithType:accountTypeTwitter
withCompletionHandler:^(BOOL granted, NSError *error) {
if(granted)
{
dispatch_sync(dispatch_get_main_queue(), ^{
self.accounts = [self.accountStore accountsWithAccountType:accountTypeTwitter];
});
}
else {
// User denied access to his Twitter accounts
NSLog(@"用戶拒絕使用twitter帳戶連接app");
}
}
];
}
else
{
// This iOS verion doesn't support Twitter. Use 3rd party library
}
}
#pragma mark - tweet
- (void)send_tweet
{
//建立viewcontroller
TWTweetComposeViewController *tweetTOtwitter = [[TWTweetComposeViewController alloc] init];
//設定推文的內容
[tweetTOtwitter setInitialText:@"N11 Studio Twitter API 測試。"];
//推文中加入圖片資訊
[tweetTOtwitter addImage:[UIImage imageNamed:@"logo.png"]];
//推文中加入網址超連結資訊
[tweetTOtwitter addURL:[NSURL URLWithString:[NSString stringWithString:@"http://n11studio.blogspot.tw/"]]];
//顯示viewcontroller
[self presentModalViewController:tweetTOtwitter animated:YES];
//按下Send或是Cancel時的處理動作(block)
[tweetTOtwitter setCompletionHandler:^(TWTweetComposeViewControllerResult result) {
NSString *tweet_action;
switch (result) {
case TWTweetComposeViewControllerResultCancelled:
tweet_action = @"取消";
break;
case TWTweetComposeViewControllerResultDone:
tweet_action = @"完成";
break;
default:
break;
}
NSLog(@"%@", tweet_action);
//移除viewcontroller
[self dismissModalViewControllerAnimated:YES];
}];
}
// get information about the currently logged in user [facebook requestWithGraphPath:@"me" andDelegate:self]; // get the posts made by the "platform" page [facebook requestWithGraphPath:@"platform/posts" andDelegate:self]; // get the logged-in user's friends [facebook requestWithGraphPath:@"me/friends" andDelegate:self];
請將你的程式碼加入FBRequestDelegate的協議(protocol),這樣才可以去處理你所請求的回應(your request responses)。
- (void)request:(FBRequest *)request didReceiveResponse:(NSURLResponse *)response {
NSLog(@"received response");
}
就可以看到你的回應已經成功。要使用此功能,請在你的class中加入『FBDialogDelegate』的協議(protocol),這樣才可以使用dialog的功能。
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Come check out my app.", @"message",
nil];
[facebook dialog:@"apprequests"
andParams:params
andDelegate:self];
[facebook dialog:@"feed" andDelegate:self];