Developing for the iPhone outside Xcode - iphone

I'd like to develop and run my iPhone applications from the command line and my personal editor instead of having to use Xcode.
So far I've been able to edit all the files in Emacs and run xcodebuild in the project to compile/link/etc.
The next step would be to create a Makefile task to launch the iPhone Simulator with my current application. Any ideas of how can I do that?
Update: I'm not interested in XCode calling my editor, I just want to forget about the IDE as much as I can.

All you need to do is copy the built .app from wherever XCode puts it to ~/Library/Application Support/iPhone Simulator/[some version]/Applications/[somefolder]/.
Then, launch /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iOS Simulator.app. Not sure how to get it to launch a specific application, but that'll take you to the home screen.

Note also that you can set up XCode to use external editors, even for source code. In this setting, you'd open XCode to look at the treeview displaying the files and other items making up your project, but once you double-click a sourcecode file it would open in e.g. Emacs.
There's a screencast over at Mac Developer Network demonstrating this: link

I doubt it. If you jailbreak your phone and install SSH on it you could set up something to >>copy the .app over wifi, but that's a fair bit of work. – Noah Witherspoon Jan 13 '09 at 5:24
I did all of my beginning iphone development work this way. Just ssh'ing over the binary executable and whatever other files you might need (after you locate the App folder on your phone) is actually much faster than installing the application from xCode. Note that I wasn't running the debugger.

Related

Unity3d OSX "Application can't be opened"

I'm using a PC and I've created a build for Mac standalone.
I shared the file with my test user by zipping and emailing the build, but when he tries to run the application he sees this error:
The application "SomeApp.app" can't be opened.
After some searching, I learned that I need to do chmod to open the file. Can anyone tell me how to do that on a Mac?
The zip format doesn't have easy support for Unix-like file permissions, so your transfer process is stripping any permission flags that OSX uses to recognize files within that zip that are supposed to be executable. This can also happen with other file transfer solutions, so it's something to watch out for.
The best solution would be to create an archive which does keep those permissions, such as a tar archive.
Failing that, you can have a Mac user open a terminal and set the permission flag manually:
chmod a+x SomeApp.app/Contents/MacOS/*
(Replace SomeApp.app with whatever your .app folder is named)
I had the same issue, I left an answer here, at the bottom: https://forum.unity.com/threads/mac-build-breaking-when-uploaded-to-storage.1093330/
The problem was not with the .zip, but rather with the build itself. Ran fine on my Mac, did NOT run fine once I uploaded it and downloaded it again (or if anyone else downloaded it).
Edited 12/8/2021, as per EmiOB's suggestion, to add the text of my answer (same as in the link):
This worked for me on 2020.3.16f1:
In the Unity Editor: Build Settings, check the box that lets you make an XCode project (requires having XCode installed, I believe I have Xcode 11)
Open the XCode project
Build
That solved my problem :)

How to copy files in iPhone /var/mobile/Container/Data/Application/Document

I develop a test app for iPhone which needs to read some file. In simulator I copied those files showed by NSSearchPathForDirectoriesInDomains. Now I try to run the same app in iPhone and it is showing /var/mobile/Containers/Data/Application/ED49734D-0E61-4BB4-B3CC-D462F3BF9215/Documents/
location, but I don't know how to put my files in Documents folder so it can be read by my app.
Please help
To copy your files, you need to:
Make sure your iPhone is jail-braked (otherwise, you wont be able to access this folder)
Install tweak from Cydia: Apple File Conduit "2" (this is version for iOS 8/9)
Transfer files with one of the following PC tools:
iTools
iFunbox
Hope this helps

Compile existing Lua app using XCode for iOS5

We had a freelance developer that went rogue and now I'm left with a Lua-based app with no build files.
I have a degree in computer science, but have no experience with Lua, so I'm wondering how I can compile this (or any Lua app) with XCode for iOS.
It's a fairly simple app. It appears as though it loads in images for navigation and displays other images as content.
How do I tell XCode to compile Lua for iOS though? I have all the files in XCode and it's compiling, but clearly its ignoring the .lua files and compiling the application shell.
I have Lua downloaded by source and also installed it via MacPorts. I read that I need to link lua.h and luac.h but I don't see how to add it as a build target.
Any advise or direction would be much appreciated.
These are the files I have:
Source Code/
build.settings
Clinical_Data/
page4a_2_Anim.lua
page4a_3_Anim.lua
page4a_4_Anim.lua
page4a_5_Anim.lua
page4b_2_Anim.lua
page4b_3_Anim.lua
page4b_4_Anim.lua
page4d_2_Anim.lua
page4d_3_Anim.lua
page4d_4_Anim.lua
config.lua
home.lua
Icon-72.png
images/
<*.png files>
main.lua
manifests/
CaseStudy.manifest.txt
ClinicalData.manifest.txt
Experience.manifest.txt
Home.manifest.txt
NavElements.manifest.txt
Pathology.manifest.txt
References.manifest.txt
Restasis.manifest.txt
menu.lua
page4a_2_Anim.lua
page4a_3_Anim.lua
page4a_4_Anim.lua
page4a_5_Anim.lua
page4b_2_Anim.lua
page4b_3_Anim.lua
page4b_4_Anim.lua
page4d_2_Anim.lua
page4d_3_Anim.lua
page4d_4_Anim.lua
parser.lua
pdfs/
<*.pdf files>
section.lua
slide.lua
slideView.lua
ui.lua
It's probably linking lua from your installed lua code. There'll be a -llua in your link code. Somewhere in your source files there'll be a
luaL_loadfile(L, file);
command. This loads the lua file.
If it's corona it might have a different way to load - haven't used it.
If you need an IDE http://www.eclipse.org/koneki/ldt/ is superb. You can remote debug your app very easily.
It looks like it may be corona from anscamobile.com.
You can download a trial version from their site to see if it compiles.

Blackberry simulator won't load cod file from eclipse

I've got eclipse installed with the appropriate blackberry plug-ins, etc. I can build the project fine. When I try to debug using the simulator, the cod file is placed into the simulator's directory and the simulator starts, but I can't find the application. It is not in the Downloads directory-thingy or anywhere else that I can see...
How do you tell fledge to load a particular cod?
I've tried all of the "solutions" in these 2, similar questions, but have had no success.
I had apparently done something that made the cod file invalid. As such, it wouldn't load into the simulators. In this particular case, a resource file had a space in it's name.

How can I install a .ipa file to my iPhone simulator

I have an iphone simulator running on my Mac.
I have a .ipa file, can you please tell me how can I install it on the simulator?
You can't. If it was downloaded via the iTunes store it was built for a different processor and won't work in the simulator.
I found an .ipa file that I wanted using iTunes and copied it over to my desktop.
After that I changed the extension to .zip and extracted it.
Next I found the Payload folder and moved the application inside to my desktop.
Finally I moved that application to my iPhone simulators applications folder found at:
HD
> Applications
> Xcode.app (right click - Show Package Contents)
> Contents
> Developer
> Platforms
> iPhoneSimulator.platform
> SDKs
> iPhoneSimulator6.0.sdk
> Applications
(Note: Some apps crash more often than others.)
In Xcode 6+ and iOS8+ you can do the simple steps below
Paste .app file on desktop.
Open terminal and paste the commands below:
cd desktop
xcrun simctl install booted xyz.app
Open iPhone simulator and click on app and use
For versions below iOS 8, do the following simple steps.
Note: You'll want to make sure that your app is built for all architectures, the Simulator is x386 in the Build Settings and Build Active Architecture Only set to No.
Path: Library->Application Support->iPhone Simulator->7.1 (or another version if you need it)->Applications
Create a new folder with the name of the app
Go inside the folder and place the .app file here.
Update for Xcode 9.4.1+
Hope my answer is getting seen down here as this took me a while to figure out but I just got it working.
First of all you need to build and run the App on your simulator. Then you open the Activity Monitor. Double click the name of your App to find its content.
In the next screen open the Open Files and Ports tab and find the line with MyAppName.app/MyAppName.
Copy the link but make sure to stop at the MyAppName.app. Do not copy the path following it.
Control click onto the finder icon and select Go to folder.
]
Paste the path and click enter. You will see your MyAppName.app file.
Copy it to the Desktop and zip it. Move it to your desired 2nd computer and unzip the file. Build a random project to have a simulator open.
Lastly: Literally drag and drop the App from your Desktop into your Simulator. You will see the install and the App opens and does not crash.
You cannot run an ipa file in the simulator because the ipa file is compiled for a phone's ARM architecture, not the simulator's x86 architecture.
However, you can extract an app installed in a local simulator, send it to someone else, and have them copy it to the simulator on their machine.
In terminal, type:
open ~/Library/Application\ Support/iPhone\ Simulator/*/Applications
This will open all the applications folders of all the simulators you have installed. Each of the applications will be in a folder with a random hexadecimal name. You can work out which is your application by looking inside each of them. Once you have found out which one you want, right click it and choose "Compress ..." and it will make a zip file that you can easily copy to another computer and unzip to a similar location.
UPDATE: For Xcode 8.0+ you need to follow below Steps:
Download application from iTunes
Select downloaded app, right click show in finder
Copy .ipa file to Desktop, rename it to .zip file
Extract that .zip file and you will get directory with application name
Check that directory you will find app file in Payload folder, copy this app file
Go to ~/Library/Developer/CoreSimulator/Devices
FYI: Library folder is hidden by default in mac, you can see hidden file using below command.
defaults write com.apple.finder AppleShowAllFiles YES;
killall Finder /System/Library/CoreServices/Finder.app
Now here you'll see many directories with long hexadecimal names, these all are simulators.
To find your desired simulator, sort these directories using "Arranged By > Date Modified".
Select that simulator file and go to below location.
<HEXADECIMAL-SIMULATOR-STRING>/data/Containers/Bundle/Application/
Create new folder name with <download-app-name> and paste app file in that folder
Open Terminal and run below command to install this application
xcrun simctl install booted <APP_FILE_PATH>
Example <APP_FILE_PATH> will be looks like below:
~/Library/Developer/CoreSimulator/Devices/<HEXADECIMAL-SIMULATOR-STRING>/data/Containers/Bundle/Application/<APP_NAME>
First of all, IPAs usually only have ARM slices because the App Store does not currently accept Simulator slices in uploads.
Secondly, as of Xcode 8.3 you can drag & drop a .app bundle into the Simulator window and it will be installed. You can find the app in your build products directory ~/Library/Developer/Xcode/DerivedData/projectname-xyzzyabcdefg/Build/Products/Debug-iphonesimulator if you want to save it or distribute it to other people.
To install from the command line use xcrun simctl install <device> <path>.
device can be the device UUID, its name, or booted which means the currently booted device.
For Xcode 10, here's an easy way that worked for me for a debug IPA (development profiles)
Unzip the IPA to get the Payload folder.
Within the Payload folder is the app executable.
Drag and drop the app to an open simulator. (You might see a green add button when you drag it over the simulator)
It should install that app on that simulator.
You can run the application file of project in simulator - not .ipa file.
You can get it from:
Libraries-->Applicationsupport-->iphone simulator-->4.3(its ur simulator version)-->applications-->then u can see many files like 0CD04F.... find out your application file through open it.
You can copy the file to your system(which system simulator u need run ) location Libraries-->Applicationsupport-->iphone simulator-->4.3(its your simulator version)-->applications-->
Then open the simulator 4.3 (its your simulator version where you pasted). You can see the application installed there.
Getting from other people:
Please tell them to find out Libraries-->Applicationsupport-->iphone simulator-->4.3(its ur simulator version)-->applications-->then you can see many files like 0CD04F.... from their system and receive that file from them.
After they have got the file, please copy and paste the file in to your system `Libraries-->Applicationsupport-->iphone simulator-->4.3(its your simulator version)-->applications-->(paste the file here).
Then you can see the app is installed in your system simulator and you can run it after clicking the file.
Copy From Here:
- Run the application in the Xcode.
- Select Finder go to Go and click on select Library Library/Application Support/iPhone Simulator/7.0.3-64/Applications
- Select 32 bit folder Copy your application.
Paste To Here:
- /Applications/Xcode-Beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhone Simulator. SDK/Applications
- Paste here and run the simulator.
With Xcode 6:
It's very possible to build and install on a simulator.
I did it by copying the debug build configuration (I called it SimRelease for my example below) in the project settings. I changed the architectures to i386 and x86_64 (not sure how necessary this was), but key difference to change between the copied build configuration is build for active architecture set to NO. After that a couple simple command line tools will do the rest!
xcodebuild -scheme YOUR_SCHEME -configuration SimRelease -sdk iphonesimulator8.1
Depending on where you have your DerivedData set you need to go find the outputted .app folder. Once you've found it you can simply install it on any simulator device. To find the device UUID's open Xcode and go to Window->Devices you'll see the list of the device instances and you can grab the UUID's. For a trivial script you could grab all of them from: ~/Library/Developer/CoreSimulator/Devices/ and install on every device.
From there the simple command to install on a device is:
xcrun simctl install DEVICE_ID APP_FOLDER_LOCATION
Here's a simple shell script to take the app and install it on every device:
app_dir=$1
current_dir=$(pwd)
cd ~/Library/Developer/CoreSimulator/Devices/
devices=$(ls -d */)
cd "$current_dir"
for device in $devices
do
device_id=${device%/}
xcrun simctl install "$device_id" "$app_dir"
done
Hope this helps! Took me a while to figure out the best way to do it.
Step to run in different simulator without any code repo :-
First create a .app by building your project(under project folder in Xcode) and paste it in a appropriate location (See pic for more clarity)
Download Xcode
Create a demo project and Start simulator in which you want to run the app.
Copy the .app file in particular location(ex :- Desktop).
cd Desktop and Run the command (xcrun simctl install booted appName.app),
App will be installed in the particular booted simulator.
Tested on iPod touch (7th generation) Simulator 13 (iOS 15.0)
Xcode and Xcode Command Line tools are already installed
Since we have an .ipa file, we can get the .app file from it
Rename .ipa file as .zip and extract the contents
Once the zip file is extracted, we can find the Payload folder which contains App_Name.app file
Open Terminal or iTerm2 app
Navigate to the folder which contains .app file
To list all iOS connected devices & iPhone simulators -> Also shows the UDID of all devices
xcrun xctrace list devices
Boot the simulator
xcrun simctl boot <UDID>
Launch the simulator
open -a simulator
Install the .app file
xcrun simctl install booted <App_Name>.app
Just drag and drop .app file to simulator it will install app automatically.
I have checked in iPhone simulator 13(iOS 15.4)