Run app phonegap with xcode on jailbroken iPhone - ios

I developed an app with phonegap, and I hate to try on a apple device. I've jailbroken my iPhone5s for try my app without pay apple.
I follow this guide, but seems does't work:
On your Jailbroken device install AppSync Unified 5.2-1 (or later)
from AngelXWind’s repo. Don’t use any other AppSync, and if you have
others, be sure to remove them. Open
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/SDKSettings.plist
and change AD_HOC_CODE_SIGNING_ALLOWED to YES. You may need to
duplicate it to the desktop, change it, save it, then drag and drop
back into the original folder because OS X let you edit the file in
place. If XCode was running, restart XCode. Change your Project and
Target settings to “Ad Hoc Code Sign” in Build Settings Tell XCode to
run app on iPhone. At this point XCode will put app on your iDevice,
but can’t debug because it can’t attach to the process. The app will
start then close immediately. You can now manually start the app on
the phone now though. To enable debugging: In your project select
File>New File Property List and create a file called
“Entitlements.plist”. Add “Can be debugged” or “get-task-allow” (both
do the same thing) and set the value to YES. Now change your Project
and Target Code Signing Entitlements (In Build Settings) to
“Entitlements.plist” (you have to type it in). Now XCode can run and
debug the app. Good luck
This is the link of the guide.
When I run app, XCode tell me "Build Success", and on top it says :"Running on Iphone". If I open detail, it say: "Preparing to install " with a loading circle. It's 20 minute that is preparing to install my app.
How can I fix this problem?

Related

Xcode 8 app runs on Simulator but doesn't display

I'm using the release version of xCode 8 and am trying to run my app on the simulators. They are all the iOS 10 simulators.
No matter which simulator I use, when I run the app the app icon shows up in the simulator but then that's it. The app never displays in the simulator. I only see the app icons of the iOS home screen.
I put some break points in my initial view controller at the viewDidLoad, viewWillAppear, and viewDidAppear methods. All of them triggered. So as far as my app is concerned, it is displaying on the device. I also get all the normal log output and networking calls happening just fine. It even shows the popups for permission to access the calendar and notifications. But my app is not brought to the foreground.
If I then click on the app icon in the simulator, my app runs normally. But it should be automatic when I hit run from xCode.
When I run my app on an iOS 10 device I get the same behaviour as all three of those view methods are called. However I don't get any of my normal log output. In fact I don't get any log output. However the app was already installed from when the device was on iOS 9.x. Not sure if that is a factor. But aside from the simulator issues, this is the bigger issue.
I've tried cleaning the build, deleting the app, I even tracked down the derived data folder and deleted that from the simulator. None worked. I also updated all my cocoa pods I have installed too.
Any one else experienced this?
That sounds weird but I read a lot of threads on the Apple Developer Forums on the same problem during the different Xcode 8 beta version, try these steps:
reset the simulator using the menu "iOS Simulator" -> "Reset Content and Settings..."
remove your 'xcuserdata' directory inside your .xcodeproj directory
do a clean build folder (hold down option key when selecting clean)
reboot your Mac
If these steps don't solve anything you can try this solution:
Copy-paste Xcode-beta.app from Applications folder to somewhere else, e.g. - Documents folder.
Delete Xcode-beta.app from Applications folder.
Move Xcode-beta.app from Documents to Applications folder again.
originally posted here, obviously using your Xcode.app instead of Xcode-beta.app.

Can I debug iOS app installed from IPA archive?

I m having some problem with my app which reproduces only when i install it ad hoc, but doesn't reproduce if i just run the app from Xcode. I would like to debug this problem, but so far i m not having any luck. I m using Xcode 5.1.1. Here is what i did:
1) Go to Product->Scheme->Edit Scheme->Archive and set build
configuration to Debug.
2) Code signing identity is set to iPhone Developer.
3) Generate Debug Symbols is set to Yes.
4) Go to Product->Archive and after it is archived, click
"Distribute", then choose "Save for Enterprise or Ad Hoc Deployment".
5) My development provisioning profile is selected.
6) Click "Export" and export the .ipa file.
7) Use iPhone configuration Utility to install the app onto the
device.
8) Run the app on the device.
9) In Xcode, go to Debug->Attach To Process->By PID or Name, enter the
app name. Xcode attaches successfully and says running the app on
iPad.
10) However, i cannot hit any breakpoints which should be hit when i
do certain actions in my app (if i install and run the app from Xcode
instead, all breakpoints are hit).
Am i missing something?
You don't have any debug information for the app at this point, and since most apps are pretty thoroughly stripped, there won't even be symbols for lldb to hook on to. So we're not going to be able to successfully set breakpoints.
When you built the app, Xcode produced a dSYM file (MyApp.app.dSYM) which has the debug info in it, so all is not lost. Problem is when you attach to some - to Xcode - random app on the device, Xcode has no way to know where to find its debug info.
You can add the debug info into your debug session in lldb by using the command:
(lldb) add-dsym <PathTo.dSYM>
You have to do this after you have attached.
lldb also uses SpotLight to find dSYM's so if you put the dSYM somewhere that SpotLight knows to search (like your Desktop or a folder under your User directory) then lldb should pick it up automatically.
You can tell whether lldb has successfully read in the dSYM by doing:
(lldb) image list <AppName>
If lldb found the dSYM, it will list the path to it on a separate line after listing the path to the AppName binary.
Jim Ingham, thanks for your answers.
I found the reason why i was unable to debug into static libraries. In each Xcode project, there is a setting called "Strip Linked Product" under "Deployment" section. In all my projects this setting was set to "Yes".
In order to debug into static libraries for an app built by archiving, i set this setting to "No" in each dependent library project (as well as the main project). This can also be set differently for Debug/Release modes. After this, i see the library symbols built during archiving and i m able to debug into library code. I hope this helps someone.
Unfortunately (or maybe fortunately) the bug i was trying to debug no longer reproduces when the library symbols are not stripped. Maybe something happens when the symbols are stripped, i will need to investigate further.
I was struggling with the same problem, and just launching my app from Xcode was not an option - I had to build the IPA, sideload it on an iOS device, and then debug. Eventually I was able to make that work with the following steps:
1) Set the scheme archive target to Debug
2) Change the following settings for the Debug builds
Keep Private External Symbols (KEEP_PRIVATE_EXTERNS) : YES
Enable Bitcode (ENABLE_BITCODE) : NO
Strip Linked Product (STRIP_INSTALLED_PRODUCT) : NO
3) Rebuild, archive, and deploy the resulting IPA file to your iOS device.
4) Launch the app, and in Xcode, select Debug/Attach to Process/YourAppName(id)
5) Break into the debugger - you should be able to see the code, put and use breakpoints, etc.
If you want to debug your code from the very beginning, just put a loop that sleeps for a second or two and then checks a flag at the top of your main function - when you break into the debugger, just change the flag to let it escape the loop.

Xcode 6 process launch failed: timed out trying to launch app

I can't debug my app because when I run it, Xcode gives me the error:
Process launch failed: timed out trying to launch app
In the device I see a black screen and after the error message the app starts.
How can I fix this?
I tried to change the code signing identity and the provisioning profile, and to refresh the provisioning profiles in the Xcode > Preferences > Accounts > Details tab.
I'm using Xcode Version 6.0.1 (6A317) with an iPad mini, running iOS 8.0 and a MacBook with OSX 10.9.4.
After this, if the iPad goes into sleep mode (the screen turns off) I can't wake it anymore; I have to do a soft reset.
You are using distribution provisioning profile rather than development profile. check this link
How to Fix:
I fix it with:
clean project (Product > Clean)
hard reset device (power button + home button)
delete app from device
close xcode
CLOSE ITUNES (itunes must be closed)
re-open Xcode and run!
I think that iTunes was the problem.
EDIT: 2017/02: Solution still Woks (Thanks to #SalGad for information).
I am using Xcode 6.2, running on iPhone 4 with iOS 7.1.2, the problems happen to me as well.
It turned out that the Project and Targets' Code Signing settings are different from each other! And that's what is causing the issue.
To solve the issue, you must make sure that their Code Signing settings is the same.
One more thing that may be a reason to launch timeout arising is that you have a lot of Provision Profiles on your device. I have about 100 of them, downloaded automatically by XCode from our team dev portal. So if your team have tons of apps and Provision Profiles, you better unlink your XCode from your Apple ID, to prevent automatic downloading for unwanted PPs. It significantly decreases app launching time.
To delete unwanted PPs from your device you have to go XCode - Window - Devices, select your device and click "Show provision profiles..." on the bottom context menu. Then you have to manually remove the profiles. Tip: use key sequences "down arrow" - "backspace", to ease the hand routine.
I had this but nothing previously posted seemed to work. This is what I did to fix the issue in Xcode 6.3.2:
Go to Product->Scheme->Edit Scheme...
Select the Run Scheme
Select the Info tab
Make sure the settings are as follows:
Build Configuration is set to "Debug"
Debug Executable is checked
Launch Automatically is checked
In my case I was using the development profile, but somehow, in Build Settings > Code Signing, the Provisioning Profile for Debug was empty.
But before setting it to "iOS Team Provisioning Profile", I had to reset my account since it said " is Not on Any Development teams"
- Xcode > Preferences > Accounts
- Remove my account (click "-")
- Add the account again
That fixed the problem
Note that if the app still manages to start on the device after Xcode displays this error, you can attach to the running process with Debug->Attach to Process.
This warning is shown when you try to run and debug your code directly in device but you are using distribution profile in your Build Settings.
To directly run the code in device and debug, you need to use development profile in your Build Settings of Xcode.
After setting the development profile, just reboot your device clean your Xcode project and run again.
I hope this helps !!
An app should return from his initialisation procedure in less then 10 seconds, or it will be killed by the OS. This is probably because you are doing too many things in the startup phase.
Try to refactor your code to do it diffrently, by doing lazy initialisation, and only initialize what is really important before showing the first view.
It's hard to give better advice before knowing more about the app itself
I have faced this issue with Xcode 6.2 and Iphone 5s with iOS version 8.3.
I get this message when I deploy the application to the device for the first time.
The work around I found was that with out unintalling the application from the device,redeploy the application from Xcode.It should run perfectly this time.
I observed this only on Xcode 6.2 not on Xcode 6.3 so this might be an Xcode to iOS version compatibility issue.
Big and weird tip for this problem... this was happening to me and none of the advice helped anywhere on the web, but then i noticed if i deleted everything out of the main ViewDidLoad method it would work. I realized there was one line of code that was messing it up. It was a line that was referencing to an array of strings that was way to big. I had something like this NSString *mystring[100][1000][100]; i accidentally added some zeros and for whatever reason this problem produced the same error message that the incorrect signing gives you. So don't let your arrays or matrixes get too out of hand!
Method #1:
Lock your phone, press XCode start, wait till XCode says "unlock your device to launch", then unlock your phone, it will be launched successfully, works every time.
Method #2:
If your goal is just to debug the app, here is another simple and straight-forward approach:
After the app is deployed, launch it manually.
Goto XCode -> Debug -> Attach to Process ... to choose your app from the list, then debug properly.
This works well for me, and it saves lots of time.
I hope this helps, thanks!

Xcode process launch failed: Security

I have been developing an app for 1 or 2 weeks now and just yesterday I have updated my iPhone 5S to the iOS 8 GM. Everything worked fine and I could test on my device as well until I deleted the app from my phone and wanted to build again. The following error appeared:
Could not launch "My App"
process launch failed: Security
When I test with the simulator it works fine.
Is this because of the iOS 8 GM update and how can I fix this launch problem?
I want to be able to test on my iPhone and in the simulator.
If you get this, the app has installed on your device. You have to tap the icon. It will ask you if you really want to run it. Say “yes” and then Build & Run again.
As from iOS 9, it is required to go to Settings → General → Device Management → Developer App → Trust`.
On some versions of iOS, you will have to go to Settings → General → Profile instead.
Updated answer for Xcode 7: Tapping the app no longer works (as of beta 1 it just displays an "untrusted enterprise developer" message with only a Dismiss button).
To fix, open the Settings app, go to General / Profiles, and you'll see your profile. Mark it trusted and things should start working normally again.
Updated For iOS 9.2.1 and Xcode 7.2.1:
Goto: Settings > General > Device Management > Select App from Developer Apps > Trust App.
Hey so the accepted answer works, except if you need to debug the initial launch of the app. However I think that answer is more of a work around, and not an actual solution. From my understanding this message occurs when you have some weirdness in your provisioning profile / cert setup so make extra sure everything is in tip-top shape in that dept. before ramming your head against the wall repeatedly.
What worked for me was as follows from the apple docs:
Provisioning Profiles Known Issue If you have upgraded to the GM seed
from other betas you may see your apps crashing due to provisioning
profile issues.
Workaround:
Connect the device via USB to your Mac
Launch Xcode Choose Window ->Devices
Right click on the device in left column, choose "Show
Provisioning Profiles"
Click on the provisioning profile in question
Press the "-" button Continue to removing all affected profiles.
Re-install the app
Make sure you right click on the image of the device not the name of the device or you won't see the provisioning profiles option. I restored my new phone from an old backup and there was a lot of cruft hanging around, i also had 2 different dev. certs active (not sure why) but i deleted one, made a new profile got rid of all the profiles on device and it worked.
Update for iOS9.2.1 and Xcode 7.2.1
If you get this error when building to a device in Xcode:
On your device, tap the app icon that would have just been added from your attempt at building the app and you should see this:
Next, on your device, go to Settings --> General --> Device Management, and you will see this page:
Select the profile you are using with Xcode, and you should see this page:
Click Trust "username#email.com" then click Trust on the next popup.
Go back to Xcode and re-run your project and it should build the app to your device.
To get around the process launch failed: Security issue and immediately launch the app on your device, tap the app icon on your iOS device after running the app via Xcode.
This will allow you to immediately run the app. It may not actually "fix" the root issue that is causing these permission alerts.
Be sure to tap the app icon while the Xcode alert is still shown. Otherwise the app will not run. I continually forget this vital step and am unable to run the app on my device. Thus I am documenting it here for myself and everyone else :)
Run the app via Xcode. You will see the security alert below. Do not press OK.
On your iOS device, tap the newly installed app icon:
After tapping the icon, you should now see an alert asking you to "Trust" the Untrusted App Developer. After doing so the app will immediately run, unconnected to the Xcode debugger.
If you do not see this "Trust" alert, you likely pressed "OK" in Xcode too soon. Do not press "OK" on the Xcode alert until after trusting the developer.
Finally, go back and press "OK" on the Xcode alert. You will have to re-run the app to connect the running app on your iOS device to the Xcode debugger.
Go to SETTINGS -> GENERAL -> Profiles & Device Management
and choose the developer profile, then push Trust.
if you do not have Profiles & Device Management menu, you have to enroll your device on beta.apple.com and download the profile from Safari.
Install the profile
Restart your device
Tap on the developer profile and trust.
You are all set.
I have the same issue. I click ok in xcode and when launching the app on my iPhone I'm asked if I want to trust this application. Doing it, the app runs and further build-and-run from xcode went without any issue until deleting the app from the iPhone and reinstalling it. Then goto first line ;-)
Alternatively if one does not see "Untrust App Developer" dialog:
Go to your iPhone > Settings > General > Profile > "you#email.com" > Trust
In iOS 9.2 they renamed the 'Profiles' to 'Device Management'
This is how you should do it now:
Settings -> General -> Device Management
Verify the app
Ok, this seems late and I was testing the app with the Internet connection off to test my app for some functionality. As I turned off the Internet, it gave me such an error. After I turned on the Internet, I could install it again. I know this is silly but this might be helpful to someone.
I had this issue before on Xcode 7. Then I realized it's all about my Internet connection: it was down, and the security check was using the
Internet to make sure your developer account is correct. And when it saw no Internet it gave this error … after I have fixed my Internet, it works well.
Xcode is able to build and install the app, but isn't able to launch it the first time. You just need to tap on the app's icon on the phone, then you will be prompted to ask if you want to trust the developer. Allow it and the app will launch, then Xcode will be able to automatically install & launch this and your other apps.
"If you get this, the app has installed on your device. You have to tap the icon. It will ask you if you really want to run it. Say “yes” and then Build & Run again."
To add to that, this only holds true the moment you get the error, if you click OK, then tap on the app. It will do nothing. Scratched my head on that for 30 odd minutes, searching for alternative ways to address the problem.
BTW, this also happens if you change the team of your target in Xcode and rebuild. Was quite puzzled to see that problem with an app that I had run on the device before. Took me a while to figure out…
Might only happen the first time building to a device with a team, though.

Install iOS app into xcode simulator?

We're iOS (and other mobile platform) developers and our sales folks routinely need to provide demos of our apps for clients. What we're trying to do is automate a process so sales people can go to a self-serve website and feed the app into their simulator.
Using xcodebuild we can kick off the build process and then present it as a secure download link (via our intranet) but all that lets them do is install it to their iOS device. This is OK except not everyone on the road has an iOS device (or some have old iPod touches, and that's super slow). So, I was thinking that there's gotta be a way to get it installed in their simulator.
I see that others have hacked it in there by zipping up a simulator directory and placing it on another:
http://discussions.apple.com/thread.jspa?messageID=7680994
Set target to simulator, release.
deploy. stop iphone simulator. zip
your app from ~/Library/Application
Support/iPhone
Simulator/User/Applications/ send it
to someone else, and let that person
know to unzip it in that folder, than
start iphone simulator - and you're
done.
I guess we can do this, but it doesn't seem deterministic (or at least, a lot harder to script). I'd prefer to work with the .app but if the only way to do it is with this hacky copy and paste operation, that'll be what we have to do.
Any thoughts?
This could work: https://github.com/landonf/simlaunch/
I have not tried it yet by myself, but from video looks like the application converts .app compiled for simulator to a launcher, which can be used to run the app in simulator without installing it through xcode.
It probably uses the same kind of approach for simulating the app without installing it first that is described here: How to install iPhone application in iPhone Simulator
I know this isn't a direct answer to your question, but have you thought about having a server (eg a Mac mini) that has all the installed software on it? Then they could just use some form of screen sharing to run the app remotely.
I've used the simulator build mechanism above with a number of clients and once they figure out the right folder to drop the actual folder into, it's gone very well.
It's a little bit of a hack as you say but in some cases it also beats having to deal with ad hoc provisioning etc when it's less important to have it on an actual device itself.
I haven't tried it yet but I've heard pretty good things about Test Flight (http://testflightapp.com/) also as a way to distribute demos/betas so that might be worth a look as well.
I just developed a pair of scripts to (a) extract an app from a iOS simulator, and (b) install it on another iOS simulator. https://github.com/christopher-prince/SimAppScripts
Locate the .app bundle in your built products directory, typically under Debug-iphonesimulator or Release-iphonesimulator. Drag and drop that bundle onto the Simulator window and it will be installed (you may need to swipe on the home screen to show the icon).
You can also script this from the command line using xcrun simctl install. The xcrun simctl launch command can also start the application.
Most build systems can be automated (or you can use a post-build script from within Xcode, ordered as the last step) to create a ZIP of the app bundle and put it somewhere for download.
(If having the Archive workflow support creating Simulator IPAs would be useful for you please file an enhancement request at https://bugreport.apple.com)
check out waxsim:
https://github.com/square/WaxSim
http://cocoamanifest.net/articles/2011/12/running-your-ios-app-in-the-simulator-from-the-command-line.html
If you build it for i386 and distribute the .app, I believe this will work.

Resources