2015年6月12日 星期五

Xcode 編譯錯誤: duplicate symbols for architecture arm64


在編譯的時候編譯失敗,並且查詢錯誤訊息:duplicate symbols for architecture arm64
於是我到專案→Target→Build Phases→Complie Source 卻沒有重複的 .m檔,我將過去的專案設定做比對,發現 Build Setting 的 No common blocks 與先前的專案設定不一樣,改為 No 便可以編譯通過。

Apple Quick Help 解釋 No common blocks:

Declaration:
GCC_NO_COMMON_BLOCKS


Description:
In C, allocate even uninitialized global variables in the data section of the object file, rather than generating them as common blocks.  This has the effect that if the same variable is declared (without extern ) in two different compilations, you will get an error when you link them. [GCC_NO_COMMON_BLOCKS, -fno-common]

2015年6月8日 星期一

2015年5月30日 星期六

繼承至 NSManagedobject 的 Entity 當作一般物件使用

NSEntityDescription *entityDescription = [NSEntityDescription entityForName:@"Device" inManagedObjectContext:[[WPCoreDataCenter sharedMainCenter] mainManagedObjectContext]];
Device *device = [[Device alloc] initWithEntity:entityDescription insertIntoManagedObjectContext:nil];
device.idnum = @"A845dd7412b56";
device.serial = @"SMACODZL";

2015年2月8日 星期日

亂數產生器

int generateRandomNumberBetweenMin(int min,int max)
{
    return ( (arc4random() % (max-min+1)) + min );
}

2014年5月27日 星期二

上架至AppStore

一. 環境需要
Xcode 5.1.1
iPhone 4 iOS 6.1.3

二. Xcode設置

1. Project -> Edit Scheme ->Archive
- Build Configuration 設定Distrbution
- Archive Name 設定要上傳的APP的名稱
- Options 打勾

2. 點擊專案 -> TARGETS
- Bundle Identifer 設定需與下圖一樣Bundle ID以及Version與下圖的Version一樣














3. 點擊專案 -> TARGETS -> Build Setting -> Code Signing
- Provisioning Profile 點擊 Distrbution然後選擇第2點Bundle Identifer 的設定值所對應到的Name.
例如:第2點所設定Bundle Identifer 為 tw.com.walton.myskykeyapp,按照下圖所示對應到的Name是MySkyKeyApp.














- Code Signing Identity點擊Distribution
例如:根據Name為MySkyKeyApp,選擇

4. Xcode左上角選擇實機,不選擇模擬器

5. Project -> Archive

6. 出現以下畫面,點擊Distribute














7. Submit to the iOS App store

8.某些步驟省略

9. 上傳失敗,出現以下提示畫面














10. 修改完之後,執行第5步驟,直到成功上傳。