目前,在iOS7中,过时的api有如下一些:
1.Map Kit framework中的MKOverlayView和它相关的子类都已经过时了。并且使用MKOverlayRenderer类来代替。更多相关资料,请看Map Kit Framework Reference。
2.在Audio Toolbox framework中的AudioSession API已经过时了。程序中应该使用AV Foundation framework中的AVAudioSession类来代替。
3.在Core Location framework中的CLRegion类已经被CLCircularRegion类取代了。只不过CLRegion类还继续存在着——当做一个抽象的基类——以对geographic和beacon region的支持。
4.CBCentral中的属性UUID已经过时了。现在使用identifier属性来对central对象进行唯一标示。
5.Game Kit framework中也有一些过时的api,主要是为了新功能提供更好的支持。相关信息请看上面提到的参考资料。
6.UIKit中有如下一些过时的内容:UIViewController的wantsFullScreenLayout属性已经过时。在iOS7以及之后的版本中,view controller一直都是全屏布局;UIPopovercontroller类不再支持箭头朝向的概念;现在支持内容呈现(presentation)朝向。UIColor对象提供的背景纹理已经不存在了。NSString中的许多功能已经过时,建议使用新的功能。
7.在libsyscall库中的gethostuuid方法已经过时。
iOS7以及之后的版本中,如果请求获取iOS设备的MAC地址,系统会返回02:00:00:00:00:00。如果需要唯一标示设备,使用UIDevice的identifierForVendor属性代替。(在程序中,如果需要自己的广告标示符,那么应该考虑使用ASIdentifierManager的advertisingIdentifier属性替代。)
关于过时API完整的列表,请看iOS 7.0 API Diffs。
|
Case I. Simple Class |
||
|
Objective-C |
XE4 |
|
|
// Protocol @protocol mycalcEvent - (void) oncalcEventA : (int) inx ext1:(int) extInx1; - (void) oncalcEventB : (int) inx ext1:(int) extInx1; @end
// ObjC Class : mycalc ------- @interface mycalc : NSObject { BOOL busy; // id <mycalcEvent> delegate; }
- (void) setDelegate:(id) delegate; - (int) calc : (int) value;
@property (nonatomic, assign) id delegate; @end |
// User Protocol ----------------------------------------------- mycalcEvent = interface(IObjectiveC) procedure oncalcEventA(inx :Integer; ext1 : Integer); cdecl; procedure oncalcEventB(inx :Integer; ext1 : Integer); cdecl; end;
// TmycalcEvent = class(TOCLocal,mycalcEvent) private public procedure oncalcEventA(inx :Integer; ext1 : Integer); cdecl; procedure oncalcEventB(inx :Integer; ext1 : Integer); cdecl; end;
// mycalc Class -------------------------------------------- mycalc = interface(NSObject) function calc ( value : integer) : integer; cdecl; procedure setDelegate ( adelegate : pointer ); cdecl; end;
// MycalcClass = interface(NSObjectClass) end; TMycalc = class(TOCGenericImport<MyCalcClass, mycalc>) end; |
|
用Delphi XE4 开发的 24点游戏求解计算器. 终于 Ready for Sale 了.
虽然很简单,但是验证了Delphi XE4 开发应用到上线是没有问题的. 没有遇到私有API问题. 而且的确是很快速,延续了Delphi 一贯的特点. 稍微注意一下分辨率支持就好了.
商店地址: https://itunes.apple.com/us/app/answer-machine-puzzle-game/id647234514?ls=1&mt=8
用XE开发IOS是非常可能的.
iAD用的就是韩国哥们的.
太赞了这个. 如此也证实了 IOS 的 Framework的使用方式. 定义接口文件,就可以了. 要做的就是语法的转换问题.
这个方法我也想过,还没有具体实施. 值得参考和扩展,其它的很多Framework 也是可以做到的. 当然还有bug// 离实际可用还有距离,
而我上次提交的App 苹果也给Reject 了. 貌似是分辨率不能支持得很好. - 是我的问题, 我用了一个WebVIew 但加载的页面没有适应ipad.
还有一个问题就是 我的应用太简单了. :) 等有时间再完善一下 再说.
1 // 2 // Delphi XE4 - iOS_Library_iAd 3 // 4 // http://blog.naver.com/simonsayz 5 // Simon,Choi (최원식옹) 6 // 7 // History 8 // 2013.05.22 Ver 0.01 1st Release 9 // 10 // Known Bug. 11 // - On Simulator, When press ad, Screen will be black. 12 // Why ? Can't solved yet. 2013.05.22 13 // 14 // Warning 15 // - This code is not perfect. Just guide to start to how to implement 16 // 17 // 18 unit iOS_Library_iAd; 19 20 21 interface 22 23 uses Macapi.ObjectiveC, 24 iOSapi.CocoaTypes, iOSapi.CoreGraphics, iOSapi.Foundation, iOSapi.UIKit; 25 26 const 27 libCoreiAd = '/System/Library/Frameworks/iAd.framework/iAd'; 28 29 Type 30 id = Pointer; 31 32 {$M+} 33 { ADBannerView } 34 ADBannerViewClass = interface(UIViewClass) end; 35 ADBannerView = interface(UIView) 36 procedure setDelegate (newValue: id); cdecl; 37 function delegate: id; cdecl; 38 function isBannerLoaded: Boolean; cdecl; 39 procedure setRequiredContentSizeIdentifiers (newValue: NSSet); cdecl; 40 function requiredContentSizeIdentifiers: NSSet; cdecl; 41 procedure setCurrentContentSizeIdentifier (newValue: NSString); cdecl; 42 function currentContentSizeIdentifier: NSString; cdecl; 43 {class} function sizeFromBannerContentSizeIdentifier 44 (contentSizeIdentifier: NSString): CGSize; cdecl; 45 procedure setAdvertisingSection (newValue: NSString); cdecl; 46 function advertisingSection: NSString; cdecl; 47 function isBannerViewActionInProgress: Boolean; cdecl; 48 procedure cancelBannerViewAction; cdecl; 49 end; 50 TADBannerView = class (TOCGenericImport<ADBannerViewClass,ADBannerView>) end; 51 52 53 { ADBannerViewDelegate Protocol } 54 ADBannerViewDelegate = interface(IObjectiveC) 55 procedure bannerViewWillLoadAd(banner: ADBannerView); cdecl; 56 procedure bannerViewDidLoadAd(banner: ADBannerView); cdecl; 57 procedure bannerView(banner: ADBannerView; didFailToReceiveAdWithError: NSError); cdecl; 58 function bannerViewActionShouldBegin 59 (banner: ADBannerView; willLeaveApplication : Boolean): Boolean; cdecl; 60 procedure bannerViewActionDidFinish(banner: ADBannerView); cdecl; 61 end; 62 63 //--------------------------------------------------------------------------- 64 TNotifyEvent = Procedure (Sender : TObject) of Object; 65 TNotifyMessageEvent = Procedure (Sender : TObject; Msg : String) of Object; 66 67 // 68 TADBannerViewDelegate = class(TOCLocal,ADBannerViewDelegate) 69 Private 70 FMe : TObject; 71 FOnLoad : TNotifyEvent; 72 FOnFail : TNotifyEvent; 73 FOnMsg : TNotifyMessageEvent; 74 public 75 procedure bannerViewWillLoadAd(banner: ADBannerView); cdecl; 76 procedure bannerViewDidLoadAd(banner: ADBannerView); cdecl; 77 procedure bannerView(banner: ADBannerView; didFailToReceiveAdWithError: NSError); cdecl; 78 function bannerViewActionShouldBegin 79 (banner: ADBannerView; willLeaveApplication : Boolean): Boolean; cdecl; 80 procedure bannerViewActionDidFinish(banner: ADBannerView); cdecl; 81 end; 82 83 // 84 TiOSiAd = Class(TObject) 85 Private 86 // 87 Function GetOnLoad : TNotifyEvent; 88 Procedure SetOnLoad ( Value : TNotifyEvent); 89 Function GetOnFail : TNotifyEvent; 90 Procedure SetOnFail ( Value : TNotifyEvent); 91 Function GetOnMsg : TNotifyMessageEvent; 92 Procedure SetOnMsg ( Value : TNotifyMessageEvent); 93 Public 94 FSelf : TObject; 95 FControl : ADBannerView; 96 FEvent : TADBannerViewDelegate; 97 // 98 Constructor Create; Virtual; 99 Destructor Destroy; Override; 100 Procedure Free; 101 // 102 Property OnLoad : TNotifyEvent Read GetOnLoad Write SetOnLoad; 103 Property OnFail : TNotifyEvent Read GetOnFail Write SetOnFail; 104 Property OnMsg : TNotifyMessageEvent REad GetOnMsg Write SetOnMsg; 105 End; 106 107 // exported string consts 108 109 function ADErrorDomain: NSString; 110 function ADBannerContentSizeIdentifier320x50: NSString; // deprecated 'in iOS 4.2 and later'; 111 function ADBannerContentSizeIdentifier480x32: NSString; // deprecated 'in iOS 4.2 and later'; 112 function ADBannerContentSizeIdentifierPortrait: NSString; 113 function ADBannerContentSizeIdentifierLandscape: NSString; 114 115 implementation 116 117 uses 118 Posix.Dlfcn; 119 var 120 iAdModule: THandle; 121 122 const 123 iAdFwk: string = '/System/Library/Frameworks/iAd.framework/iAd'; 124 125 function ADErrorDomain: NSString; 126 begin 127 Result := CocoaNSStringConst(iAdFwk, 'ADErrorDomain'); 128 end; 129 130 function ADBannerContentSizeIdentifier320x50: NSString; 131 begin 132 Result := CocoaNSStringConst(iAdFwk, 'ADBannerContentSizeIdentifier320x50'); 133 end; 134 135 function ADBannerContentSizeIdentifier480x32: NSString; 136 begin 137 Result := CocoaNSStringConst(iAdFwk, 'ADBannerContentSizeIdentifier480x32'); 138 end; 139 140 function ADBannerContentSizeIdentifierPortrait: NSString; 141 begin 142 Result := CocoaNSStringConst(iAdFwk, 'ADBannerContentSizeIdentifierPortrait'); 143 end; 144 145 function ADBannerContentSizeIdentifierLandscape: NSString; 146 begin 147 Result := CocoaNSStringConst(iAdFwk, 'ADBannerContentSizeIdentifierLandscape'); 148 end; 149 150 //------------------------------------------------------------------------------ 151 // 152 // iOSAd := TiOSiAd.Create(nil); 153 // iOSAd.Parent := Self.View; 154 // 155 //------------------------------------------------------------------------------ 156 157 // 158 Procedure TADBannerViewDelegate.bannerViewWillLoadAd(banner: ADBannerView); 159 begin 160 if Assigned(FOnLoad) then FOnLoad(FMe); 161 if Assigned(FOnMsg ) then FOnMsg(FMe,'willLoadAd'); 162 end; 163 164 // 165 Procedure TADBannerViewDelegate.bannerView 166 (banner: ADBannerView; didFailToReceiveAdWithError: NSError); 167 begin 168 if Assigned(FOnFail) then FOnFail(FMe); 169 if Assigned(FOnMsg ) then FOnMsg(FMe,'didFailToReceiveAdWithError'); 170 end; 171 172 // 173 procedure TADBannerViewDelegate.bannerViewDidLoadAd(banner: ADBannerView); cdecl; 174 begin 175 if Assigned(FOnFail) then FOnFail(FMe); 176 if Assigned(FOnMsg ) then FOnMsg(FMe,'ViewDidLoadAd'); 177 end; 178 179 // 180 function TADBannerViewDelegate.bannerViewActionShouldBegin 181 (banner: ADBannerView; willLeaveApplication : Boolean): Boolean; cdecl; 182 begin 183 if Assigned(FOnFail) then FOnFail(FMe); 184 if Assigned(FOnMsg ) then FOnMsg(FMe,'ActionShouldBegin'); 185 Result := True; 186 end; 187 188 // 189 procedure TADBannerViewDelegate.bannerViewActionDidFinish(banner: ADBannerView); cdecl; 190 begin 191 if Assigned(FOnFail) then FOnFail(FMe); 192 if Assigned(FOnMsg ) then FOnMsg(FMe,'ActionDidFinish'); 193 end; 194 195 //------------------------------------------------------------------------------ 196 197 // 198 Constructor TiOSiAd.Create; 199 begin 200 inherited; 201 // initialize -------------------------- 202 FEvent := TADBannerViewDelegate.Create; 203 FEvent.FOnLoad := nil; 204 FEvent.FOnFail := nil; 205 // 206 FControl := TADBannerView.Wrap( TADBannerView.OCClass.alloc); 207 FControl.initWithFrame( CGRectMake (0,480-20-50,320,50) ); 208 FControl.setCurrentContentSizeIdentifier(ADBannerContentSizeIdentifierPortrait); 209 FControl.setDelegate(FEvent.GetObjectID); 210 // 211 FSelf := Self; 212 end; 213 214 Destructor TiOSiAd.Destroy; 215 begin 216 // 217 FControl.release; 218 FControl := nil; 219 // 220 FEvent.Free; 221 FEvent := nil; 222 // 223 inherited; 224 end; 225 226 // 227 Procedure TiOSiAd.Free; 228 begin 229 If Self <> nil then 230 Destroy; 231 end; 232 233 // 234 Function TiOSiAd.GetOnLoad : TNotifyEvent; 235 begin 236 Result := FEvent.FOnLoad; 237 end; 238 239 // 240 Procedure TiOSiAd.SetOnLoad ( Value : TNotifyEvent ); 241 begin 242 FEvent.FOnLoad := Value; 243 end; 244 245 // 246 Function TiOSiAd.GetOnFail : TNotifyEvent; 247 begin 248 Result := FEvent.FOnFail; 249 end; 250 251 // 252 Procedure TiOSiAd.SetOnFail ( Value : TNotifyEvent ); 253 begin 254 FEvent.FOnFail := Value; 255 end; 256 257 // 258 Function TiOSiAd.GetOnMsg : TNotifyMessageEvent; 259 begin 260 Result := FEvent.FOnMsg; 261 end; 262 263 // 264 Procedure TiOSiAd.SetOnMsg ( Value : TNotifyMessageEvent ); 265 begin 266 FEvent.FOnMsg := Value; 267 end; 268 269 initialization 270 iAdModule := dlopen(MarshaledAString(libCoreiAd), RTLD_LAZY); 271 272 finalization 273 dlclose(iAdModule); 274 275 end.
只需要把上述两个文件保存以后 加入工程就可以了.

Used in the Delphi Firemonkey Platform is very large, and is well organized. Of course Button, alone Firemonkey, and written.However, under certain circumstances in the OS the Native Control, because you will inevitably need to use a different API, about how to use the Native Control to learn.
// // XE4 & iOS Button Example // // http://blog.naver.com/simonsayz // // Ref. // SampleNiblessApp : http://rvelthuis.de/zips/sampleniblessapp.7z // CCR.NSAlertHelper : http://code.google.com/p/delphi-foundations/ // Delegate Example : http://blogs.embarcadero.com/teamj/2013/05/09/3817/ // XE2, Free Pascal : http://blog.naver.com/simonsayz/120162838290 // Source to Html : http://www.duketown.com/marcel/hyperdelphi.shtml // unit Unit1; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls, FMX.Platform.iOS, FMX.Layouts, FMX.Memo, // System.TypInfo, Macapi.ObjectiveC, Macapi.ObjCRuntime, iOSapi.CocoaTypes, iOSapi.foundation, iOSapi.uikit, iOSapi.CoreGraphics; type // IBtnDelegate = interface(NSObject) procedure BtnPressed; cdecl; end; // TBtnDelegate = class(TOCLocal) Private Finx : Integer; FMemo : TMemo; Public constructor Create( inx : integer; memo : TMemo ); function GetObjectiveCClass : PTypeInfo; override; procedure BtnPressed; cdecl; end; // TForm1 = class(TForm) Button1: TButton; Memo1: TMemo; procedure Button1Click(Sender: TObject); private public BtnDelegate : TBtnDelegate; end; var Form1: TForm1; implementation {$R *.fmx} Constructor TBtnDelegate.Create ( inx : integer; memo : TMemo ); begin inherited Create; Self.Finx := 10; Self.Fmemo := Memo; end; function TBtnDelegate.GetObjectiveCClass : PTypeInfo; begin Result := TypeInfo(IBtnDelegate); end; // procedure TBtnDelegate.BtnPressed; begin inc(Finx); FMemo.Lines.add('iOS Btn Pressed '+IntToStr(Finx)); end; // procedure TForm1.Button1Click(Sender: TObject); Var Btn : UIButton; begin // Memo1.Lines.Add('FMX Btn Pressed'); // Btn := TUIButton.Wrap( TUIButton.OCClass.buttonWithType(UIButtonTypeRoundedRect) ); // Btn.setFrame ( CGRectMake(40,130,240,100) ); Btn.setTitle (NSStr('iOS UIButton Pressed'),UIControlStateNormal); // BtnDelegate := TBtnDelegate.Create(10,Memo1); // Btn.addTarget( BtnDelegate.GetObjectID, // target sel_getUid('BtnPressed'), // action UIControlEventTouchDown); // event // WindowHandleToPlatform(Self.Handle).View.addSubview(Btn); //亮点啊!!!cnsoft mark end; end.

