Sign in Join
Wiki copytemporary

iPhone Laz Extension: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11*(iOS only)*
22
33### About
44
55*iPhone Laz extension* is Lazarus IDE extension that's designed to simplify iPhone applications development.
66
77Before you use the extension, it's recommended to learn the page about [[iPhone/iPod development]].
88
99The extension does **NOT** provide another LCL WidgetSet (like Carbon or Cocoa) nor requires to use any.
1010
1111### Author
1212
1313Dmitry 'skalogryz' Boyarintsev
1414
1515email: skalogryz dot lists at gmail dot com
1616
1717### License
1818
1919[modified](http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL) [LGPL](http://svn.freepascal.org/svn/lazarus/trunk/COPYING.LGPL) (same as the FPC RTL and the Lazarus LCL). You can contact the author if the modified LGPL doesn't work with your project licensing.
2020
2121### Download
2222
2323The latest stable release can be found at svn:
2424
25-`svn co `[`https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/iphonelazext`](https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/iphonelazext)
25+```text
26+svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/iphonelazext
27+```
2628
2729### Change Log
2830
2931- Version 0.5 05 Jan 2010
3032- Version 0.7 Feb 2013
3133- Winter-Spring 2016
3234 - added support for reading/writing Xcode project
3335 - reading/repopulating the list of uploaded files
3436 - initial support for sim debugging
3537
3638### Dependencies / System Requirements
3739
3840- Lazarus 0.9.29 (SVN trunk) or higher. (for Project options integration)
3941- Leopard 10.5 (Intel) + iPhoneSDK/Xcode 3.1 or higher
4042- Snow Leopard 10.6 + iPhoneSDK/Xcode
4143- FPC 2.4.0 (FPC 2.5.1 (or higher) with Objective-P syntax is recommended to use).
4244- Since Apple doesn't provide any tools for development on other than macOS system, the package cannot (should not) be installed and used on Windows or Linux.
4345
4446Status: *Beta*
4547
4648### Known Issues:
4749
4850- Project launched from Lazarus fails with an exception. It should be launched from the iPhone simulator
4951- The project, using iPhoneAll unit, compiled for the simulator must use Smart Linking switch (-XX)
5052- When application's title is changed (in Project options) a string is added to the main file
5153
5254``` pascal
5355 Application.Title := 'MyApp';
5456```
5557
5658It must be deleted manually
5759
5860- XCode sometimes fails to debug the application on iDevice, though it's loaded successfully. Don't worry. Your application is still on the iDevice and ready to be tested.
5961- *todo:*
6062
6163### To do:
6264
6365- Improve debugging abilities
6466
6567## Installation
6668
6769In order to develop for iPhone or iPod, you'll need arm FPC compiler with rtl and packages installed in the system. There're 2 ways to do it: built manually via SVN or installed from a special FPC arm package. Both ways are described [[iPhone/iPod development|here]].
6870
6971You don't need to install ARM compiler or packages, if you're planning to use iPhone simulator only.
7072
7173- Get the package source via svn or download from Sourceforge
7274- Open and install the package
7375- You will find iPhone options group added to both Project and Environment options
7476
7577![](/wiki-images/e/e9/Projoptions.png)
7678
7779## How to use
7880
7981### Common usage
8082
8183- Mark a project as iPhone project (using Project menu -\> is iPhone project or Project Options -\> iPhone -\> is Phone project application)
8284
8385![](/wiki-images/0/04/Iphoneextmenu.png)
8486
8587- To change the displayed name of the application you must change the application Title in Project Options.
8688
8789- You can also change the application icon in the same way
8890
8991### iPhone Simulator
9092
9193- To install the application to iPhone simulator you need simply to build the project (ctrl+F9/cmd+B).
9294
9395The installation is always performed then you try to build the project.
9496
9597iPhone simulator apps require special environment, created by the simulator or they will fail with "trace error" if run in pure OSX. To make the simulator Run everytime you're running the application, select in menu "Run-\>Run parameters..." check "Use launching application" put there
9698
97-`'/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator'`
99+```text
100+'/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator'
101+```
98102
99103Note: the location of iPhone simulator.app may vary, depending on the iPhone SDK installation path.
100104
101105It's not required, but you'll need to launch iPhoneSim manually otherwise.
102106
103107- After you build run the iPhone Simulator, your application should be on the one of the iPhone simulated pages.
104108
105109![](/wiki-images/c/c6/Iphonesim.png)
106110
107111It's possible, that iPhone sim also starts the required application (as Xcode does), but this possibility is undocumented by Apple. You can use it on your own risk. Please refer to <http://github.com/jhaynie/iphonesim>
108112
109113### Project to Xcode
110114
111115There's not way to install an application to iPhone, but using Xcode (or purchasing it via iTunes). (Jailbreaks have their own way, not used by the package). The package provides an utility to generate an Xcode project from Lazarus project.
112116
113117- Write the program (and test it on the Simulator, if necessary)
114118- Select Project -\> Update XCode project. If not exists *xcode* directory is selected there you'll find xcode project. If project exists, it's configuration will be updated
115119
116120![](/wiki-images/f/f1/Findershot.png)
117121
118122- Open the project (project1.xcodeproj on the screenshot) . Select iPhone device for as Active SDK.
119123- You might need to specify Code identity in Build configuration (please, refer to iPhone Developer program portal)
120124- Press Build and Go. This should build the application and install it to iPhone device.
121125
122126![](/wiki-images/4/43/Xcodeproj.png)
123127
124128Note:
125129
126130- You'll need arm-darwin FPC compiler installed and configured. Any units or package used, must be compiled for arm-darwin target as well.
127131- Created XCode project, is not flexible enough to build the project for iPhone Simulator, so make sure that iPhone OS is used as active SDK.
128132
129133## Examples
130134
131135The extension also includes a few sample projects. (see *examples* dir at the iphonelazext directory)
132136
133137### Hello World
134138
135139The sample requires a objective-p compiler with any version of iPhoneAll unit.
136140
137141The example has been written using iPhoneAll of this version (https://github.com/genericptr/iOS_8_0).
138142
139143The intent of the sample is to show how to go from Lazarus project to Xcode project.
140144
1411450\. Install iPhone Laz Extension. Make sure you've FPC cross-compiler prepared. It's better to have it ready for all iOS targets (i386-iphonesim, x86_64-iphonesim, arm-darwin, aarch64-darwin). The compilation script will build both 32 and 64-bit targets.
142146
1431471\. The example project in Lazarus
144148
1451492\. Open Project Options
146150
1471512.1 Compiler Options -\> "Paths": specify where iPhoneAll unit is located at "Other unit files (-Fu)"
148152
1491532.2 Make sure -dIPHONEALL is present in "Custom Options" (thought it might not be needed for the version of iPhoneAll you're using)
150154
1511552.3 in "iPhone Specific" section check the box "is iPhone application project"
152156
1531572.4 Close the dialog by hitting "OK"
154158
1551593\. in Project menu press "Update Xcode project"
156160
1571614\. At the directory with the lazarus project a new "xcode" directory will created. Within the directory there should be "ihelloworld.xcodeproj" generated. Double-click on the bundle so Xcode will start.
158162
1591635\. In Xcode. make sure you've a simulator selected as a target device. Hit "Play" icon (top-left side of the window) ( or through menu Product -\> Run )
160164
1611655.1 This should start compilation of the project. If no issues would be detected, the simulator will start. As soon as its booted Xcode will install the application and run it.
162166
1631676\. An actual device. Plug your device via USB.
164168
1651696.1 In "General" tab you should see a "warning sign" with "No identity or provisioning profile". "Fix issue" button should be availabe.
166170
1671716.2 Hit the button. The Xcode should get you a certificate, so you'd be able to run the application on your device.
168172
1691736.3 Select the device as run target (top-left side of the Xcode window).
170174
1711756.4 Clear the project (Product -\> Clear)
172176
1731776.5 Run the project (Product -\> Run)
174178
175179The result would look like:
176180
177181![](/wiki-images/5/51/Iphonescreenshot.png)
178182
179183### iArkanoid
180184
181185Written from scratch simple arkanoid game UIKit and GoreGraphics games for iPhone/iPod.
182186
183187![](/wiki-images/f/fd/IArkShot.png)
184188
185189---
186190*From the Free Pascal wiki, page "iPhone Laz Extension", as it stood on 2019-12-22 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
187191Category: Lazarus IDE plugins
188192Category: Lazarus-CCR
189193Category: iOS
190194Category: macOS

Back to history