2018年11月26日 星期一

關於 Embarcadero RAD Studio 10.3 for iOS



終於把 MCU 部份搞定了
開始回來測試 ERS for iPad
但測試版的序號到期, 暈!

//==========================================================
RAD Studio 10.3 Rio (Update 1) 
10.3 Rio - Release 1
New features and customer reported issues fixed in RAD Studio 10.3.1
RAD Studio 10.3.1 is here, Happy Birthday Delphi!
delphicbuilder10_3_1_194899.iso
//==========================================================

//==========================================================
現在測試版的序號到期, 而且有一些技術上疑問也找不到解決方案
(已購買ERS可以找 Taiwan FAE 解決及詢問)

現在已改用Xcode + swift
雖然swift比不上 ERS 方便及好用
但至少遇到的疑問在 Google 都找的到答案

在使用Xcode swift開發 iOS APP期間, ERS開發者介面比 Xcode 強大好多.
Swift的程式語法及架構, 有點無言 
//==========================================================
iOS Development 可以在實機 iPad 上執行及 Step by Step Debug

iOS Ad Hoc Deploy ipa file 可以在實機 iPad 上執行

iOS Applicaption Store Deploy ipa file 是無法直接在實機 iPad 上測試
   請參考 Running the Application的解釋
   應該是要先上架 Apple App Store後, 再從App Store下載及安裝, 才能在 iPad 實機上測試.
   如果有其他的解決方案 請告知我

//==========================================================

iPad 6th (iOS 12.11)必須配合 Xcode 10.1,  ERS 才能執行
BCB 還是落後 Delphi 一代,
(Delphi可以在 iOS 12.11執行, BCB 確會出現錯誤)
把退回舊版Xcode 9.1, 那這樣 iPad 新版本作業系統的就無法執行
所以....

enum {
DISPATCH_WALLTIME_NOW DISPATCH_ENUM_API_AVAILABLE
(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) = ~1ull,
};

[bccosx Error] time.h(71): E2324 Numeric constant too large



Delphi 就沒有上述的問題

//==========================================================

BCB Debug Watch List 無法看到iPad 的變數
只能用猜的嗎?



//==========================================================
[PAClient Error] Error: E0264 Unable to execute '"/usr/bin/codesign" --deep -s
"iPhone Distribution: XXXX CO., LTD. (123F45CWXX)" -f
"/Users/jun/PAServer/scratch-dir/macOS 10.13.6/tt.app"' (Error 1)
這是 ERS 使用 PAServer 進行 codesign Certificate app 的指令

//==========================================================
[PAClient Error] Error: E0264 iPhone Distribution: XXXX CO., LTD. (123F45CWRC):
 ambiguous (matches "iPhone Distribution: XXXX CO., LTD. (123F45CWRC)"
  and "iPhone Distribution: XXXX CO., LTD. (123F45CWXX)"
   in /Users/jun/Library/Keychains/login.keychain-db)

這是因為點了 XCode -> Account -> Manage Certificate  -> + -> iOS Distribution
造成iPhone Distribution重覆的問題



//==========================================================
ERS 把一些 Apple Developer Certificates 流程省略, 沒有解釋清楚要如何設定,
造成開發者要自行研究這一部份.

關於Apple 憑證的設定, 請務必先看這篇, 雖然 Xcode 10.1有一點修改, 但原則上相通的


 http://delphi.ktop.com.tw/board.php?cid=32&fid=107&tid=109133
沒有這篇的解釋, 我一定做不出來一個 iPad APP
感謝分享!

搞了好幾天, 都做不出來.
就是少做了 "Worldwide Developer Relations Certificate Authorith" 下載及點選

//==========================================================
Could not locate device support files.
This iPad (6th generation) (Model A1893) is running iOS 12.1.1 (16C50), which may not be supported by this version of Xcode.

因為 iPad 版本比較新 (Apple 不讓使用舊版 iOS)
所以表示要改安裝 XCode 10.1 版本

//==========================================================

ID: 30869, December 2018 Missing Files Patch for 10.3
  December 2018 Missing Files Patch for 10.3

Mobile Tutorials: Mobile Application Development (iOS and Android)
for Rad Studio 10.2 Tokyo 


1: 可以支援 XCode 10.1  版本
     https://developer.apple.com/download/more/

2: 還是只能支援 XCode iOS 10.3 simruntime
    (請開啟 XCode 中點選下載)
3: 安裝後 Android SDK並沒有安裝完整
修正如下:
先刪除 SDK Manager 中的 Android SDK 25.2.5 32bit
C:> CD C:\Users\Public\Documents\Embarcadero\Studio\20.0\CatalogRepository\AndroidSDK-2525_20.0.32429.4364\tools
或者是
C:> CD C:\Users\Public\Documents\Embarcadero\Studio\20.0\PlatformSDKs\android-sdk-windows\tools

重建一個 Android SDK 25.2.5 32bit
C:> android.bat update sdk --no-ui --all --filter platform-tools,build-tools-28.0.2,android-26

Android SDK 路徑如下
C:\Users\Public\Documents\Embarcadero\Studio\20.0\CatalogRepository\AndroidSDK-2525_20.0.32429.4364
Android NDK 路徑如下
C:\Users\Public\Documents\Embarcadero\Studio\20.0\CatalogRepository\AndroidNDK-17b_20.0.32429.4364


//==========================================================
關於Apple 憑證的設定, 請務必先看這篇, 雖然 Xcode 10.1有一點修改, 但原則上相通的
 http://delphi.ktop.com.tw/board.php?cid=32&fid=107&tid=109133

//==========================================================

問題: can't start debugserver on device - device support image was not mounted


這是奇怪的現象, 簡單的說就是
(一定要使用Apple 原廠的USB線材)
Step 1: 先把 iPad 拔除和 iMac 取消連接
Step 2: 開啟 Xcode -> Windows -> Devices -> Devices
Step 3: iPad 和 iMac 連接
Step 4: 重新啟動 ERS Delphi Debug


//==========================================================
問題: unable to match bundle identifier
ERS Delphi Project -> Options -> Version Info
 CFBundlenName 和 CFBundleIdentifier  要設定為 App IDs
 CFBundlenName  => Project Name
 CFBundleIdentifier  => com.xxx.ProjectName
Project Debug / Release 都要設定


//==========================================================
問題:  Invalid compiler directive: 'false'
重新點選 ERS Delphi Project -> Options -> Debug Information



//==========================================================
Step 1:
 開啟 鑰匙圈存取.app
  Menu -> 鑰匙圈存取 -> 偏好設定 -> 重置我的預設鑰匙圈
  Menu -> 鑰匙圈存取 -> 憑證輔助程式 -> 從憑證授權要求憑證
  產生
   CertificateSigningRequest.certSigningRequest
Step 2:
 To developer.apple.com
 ISO,tvOS, watchOS
  Certificate
   All
    iOS Certificate => click +
     Select  "Worldwide Developer Relations Certificate Authorith"
     Download "AppleWWDRCA.cre"
   
Step 3:
 macOS
 鑰匙圈存取.app -> Click "登入" -> Click "憑證"
 Find app -> Double Click "AppleWWDRCA.cre"
 我的建議是這時最好把 macOS 重新開機
 再開啟鑰匙圈存取, 一定要在憑證中看到 "Apple Worldwide Developer Relations Certificate Authorith"
 沒有的話, 請重點 "AppleWWDRCA.cre"或等個幾分鐘, 再重新開機
 反正一定要出現, 沒出現的話, 後面步驟都是無效的
 PS: 要注意查看一下 AppleWWDRCA的有效期限.

Step 4:
 To developer.apple.com
 ISO,tvOS, watchOS
  Certificate
   All
    iOS Certificate => click +
    => Click "IOS App development"
    => Continue
    => Continue
    => Choose File -> "CertificateSigningRequest.certSigningRequest"
    => Continue
    => Download -> iOS_development.cre
    => Done
 
Step 5:
 To developer.apple.com
 ISO,tvOS, watchOS
  Certificate
   All
    => iOS Certificate
     => click +
     => Click "App Store and Ad Hoc"
     => Continue
     => Continue
     => Choose File -> "CertificateSigningRequest.certSigningRequest"
     => Continue
     => Download -> iOS_distribution.cre
     => Done
 
Step 6:
 To developer.apple.com
 ISO,tvOS, watchOS
  Idenifiers
   => App IDs
    => click +
    => App ID Description
      Name ->  myprojectname
    => Click "Explicit App ID"
    => Bundle ID ->  tw.com.mydomain.myprojectname
    => Continue
    => Register
    => Done
 
Step 7:
 To developer.apple.com
 ISO,tvOS, watchOS
  Devices
   All
    => click +
    => Name -> iPad name
    => UUID -> iPad UUID Code
   iPad UUID Code可以在 Xcode Devices 中查得
 
 
Step 8:
 To developer.apple.com
 ISO,tvOS, watchOS
  Provisioning Profiles
   All
    => click +
    => Development
       Click "IOS App development"
    => Continue
    => Select App IDs -> tw.com.mydomain.myprojectname
    => Continue
    => Select All -> xxxx (iOS Development)
    => Continue
    => Select All -> iPad name
    => Continue
    => Profile Name -> iOS_development_mydomain_myprojectname
    => Continue
    => Download
       File save -> iOS_development_mydomain_myprojectname.mobileprovision
    => Done
   
Step 9:
 To developer.apple.com
 ISO,tvOS, watchOS
  Provisioning Profiles
   All
    => click +
    => Distrbution
       Click "App Stroe"
    => Continue
    => Select App IDs -> tw.com.mydomain.myprojectname
    => Continue
    => Select xxxx (iOS Distrbution)
    => Continue
    => Profile Name -> iOS_Distrbution_AppStore_mydomain_myprojectname
    => Continue
    => Download
       File save -> iOS_Distrbution_AppStore__mydomain_myprojectname.mobileprovision
    => Done
   
Step 10:
 To developer.apple.com
 ISO,tvOS, watchOS
  Provisioning Profiles
   All
    => click +
    => Distrbution
       Click "Ad Hoc"
    => Continue
    => Select App IDs -> tw.com.mydomain.myprojectname
    => Continue
    => Select xxxx (iOS Distrbution)
    => Continue
    => Select All -> iPad name
    => Continue
    => Profile Name -> iOS_Distrbution_AdHoc_mydomain_myprojectname
    => Continue
    => Download
       File save -> iOS_Distrbution_AdHoc_mydomain_myprojectname.mobileprovision
    => Done
 //==========================================================
問題: 無法登入  Xcode -> Open Developer Tools  ->  Application Loader

登入 https://appleid.apple.com/account/manage
點選 App 專用密碼 產生密碼⋯

重新進入 Application Loader
使用Apple ID 配合用這組產生的密碼登入



 //==========================================================