Finding xcode project name of a ported ionic app to ios to lauch multiple simulators - ios

As a school project, I'am working on a iOS port of a ionic chat app. After a lot of troubleshooting, I finally managed to make it work on one device. Now I want to use multiple simulators to test the chat capabilities of my app.(following this tutorial on medium).
But the problem arises on the created launch script part where I need to find my project name:
path=$(find ~/Library/Developer/Xcode/DerivedData/<YOUR_PROJECT_NAME>-*/Build/Products/Debug-iphonesimulator -name "<YOUR_APP_NAME>.app" | head -n 1)
So I tried tried the command:
find ~/Library/Developer/Xcode/DerivedData/Spiel* -maxdepth 1 -type d
and instead of returning only 1 projects it returns several ones:
/Users/soyanchardon/Library/Developer/Xcode/DerivedData/Spiel-azmvgnpavliucyaxeiykxemnwbpv
/Users/soyanchardon/Library/Developer/Xcode/DerivedData/Spiel-azmvgnpavliucyaxeiykxemnwbpv/Logs
/Users/soyanchardon/Library/Developer/Xcode/DerivedData/Spiel-azmvgnpavliucyaxeiykxemnwbpv/Index
/Users/soyanchardon/Library/Developer/Xcode/DerivedData/Spiel-azmvgnpavliucyaxeiykxemnwbpv/Build
/Users/soyanchardon/Library/Developer/Xcode/DerivedData/Spiel-bmjzcrhlutzmbahdmqohtaidhhyj
/Users/soyanchardon/Library/Developer/Xcode/DerivedData/Spiel-bmjzcrhlutzmbahdmqohtaidhhyj/Logs
/Users/soyanchardon/Library/Developer/Xcode/DerivedData/Spiel-bmjzcrhlutzmbahdmqohtaidhhyj/TextIndex
/Users/soyanchardon/Library/Developer/Xcode/DerivedData/Spiel-bmjzcrhlutzmbahdmqohtaidhhyj/Index
/Users/soyanchardon/Library/Developer/Xcode/DerivedData/Spiel-bmjzcrhlutzmbahdmqohtaidhhyj/Build
/Users/soyanchardon/Library/Developer/Xcode/DerivedData/Spiel-gfcbagyqlgghbkbfgbyqgscyprjn
/Users/soyanchardon/Library/Developer/Xcode/DerivedData/Spiel-gfcbagyqlgghbkbfgbyqgscyprjn/Logs
/Users/soyanchardon/Library/Developer/Xcode/DerivedData/Spiel-gfcbagyqlgghbkbfgbyqgscyprjn/TextIndex
/Users/soyanchardon/Library/Developer/Xcode/DerivedData/Spiel-gfcbagyqlgghbkbfgbyqgscyprjn/Index
/Users/soyanchardon/Library/Developer/Xcode/DerivedData/Spiel-gfcbagyqlgghbkbfgbyqgscyprjn/Build
As you can see I have 3 Spiel folders, and I don't know which one should I choose.
Also as an additional question, why is there 3 folders? I assume it was because of my previous failed attempts to port the app, but I really have no clue!
Thanks you.

Just delete these folders from DerivedData and rebuild. Like this, you will have only one option to choose.
And yes, the problem comes from the previous attempts.

Related

Embedding a custom video in a XCUITest

I'm writing a test that is supposed to test uploading a video file, using XCUITest in XCode 12. The test is supposed to be self-contained so I'm not certain how to exactly do this.
Typically I want the flow to work like this:
App builds
File is copied from the code folder (I've moved the video to be in the code) into the simulator
Tests run
However step 2 is giving me a ton of problems. I'm trying using this in a build phase:
xcrun simctl addmedia booted ~/code/resources/Video.mov
Bur it's currently giving a completely unspecified error. I'm not sure if this is because I'm trying to do it before the simulator is "booted" or if something else is going on. Does anyone have a solution?
I figured it out. The correct way to do this was to just use a . instead of ~ and then realize that:
. puts you at the project level (.xcproj)

Audiokit 4.5 playgrounds opening, building, but no sound

In the past I've got previous versions of the playgrounds to work. However I can't get the new 2 day old version (4.5.0) from GitHub to work.
I downloaded the zip file from https://audiokit.io/downloads/ page.
I expanded the zip.
I launched Xcode by clicking on the AudioKitPlaygrounds.xcodeproj file.
I go to the Hello World tutorial.
I click on run button and it builds successful.
No errors, nothing in console, no yellow or red build or runtime errors - but no sound. Also no sound in the handful of other playgrounds I spot tested.
I search on the internet - and found an answer saying to add this setting, but it had no effect.
AKSettings.playbackWhileMuted = true
The volume is definitely on. I have got the ROMPlayer working as a separate project using cocoa pods. But not the playgrounds. Any help much appreciated. Thanks Domc
I've resolved partly the issue - although not clear to me why this works - answer posted in case it's helpful for others.
Having tried downloading various versions, none of which worked, I tried to build many times. I noticed it seemed to be getting stuck on "Running ...." with spinning dial at top.
Researching this led me to a post re another playground with similar problem that said to untick and tick the links to the frameworks on the individual frameworks pages which I did.
A few minutes later I tried running again and I got sound! However if I select the table of contents the whole program crashes x-code and on reload you have to 'reconnect' the frameworks by ticking and unticking. [Probably this shouldn't be happening]

Xcode export localization throws error "Argument list too long"

I've got a very curious error to share regarding Xcode localization process. I will try to share as much detail as legally possible.
From Xcode, I am trying to export an XLIFF file to send to our translators, via "Editor > Export for Localizations". However, this immediately throws error with the message:
The operation couldn't be completed. Argument list too long
This is indeed confusing, as I cannot find a more verbose log anywhere (I have already tried checking my Console.app). So, I spent quite a few time googling – to no avail. I couldn't find similar case like this. The error itself happens only when I am trying to export for localization. I can build and run the app just fine.
Facts
~ $ xcodebuild -version
Xcode 8.2
Build version 8C38
~ $ xcode-select -version
xcode-select version 2347.
~ $ echo $PATH
/Users/david.christiandy/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/david.christiandy/arctools/arcanist/bin:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
I am using Xcode 8.2 on macOS Sierra 10.12.5.
The error happens only when I try exporting from localization. This is also true when I run the localization process via xcodebuild -exportLocalizations.
I can build and run the app just fine. (I believe) there's no problem with my header search paths.
Attempts
Thought there was something wrong in the code, so I tried to run the export process (via xcodebuild command) in a CI. Somehow, it's working. For the record, I am using Bitrise CI with the same stack as my system (Xcode 8.2.x, macOS 10.12)
Asked colleagues to run export process on their machines, and they have the same error.
This leads me to think that there must be something wrong with the configuration. So I made a standalone project to confirm that the export process fails consistently. Turns out, it works just fine!
So, the hypothesis I got currently is:
There's probably something wrong in the code, and
There might be tools/software (that most of our iOS engineers installed) that might contribute to the error (since the CI completes just fine).
I don't know why the CI can run the export process just fine, and I don't know when it might suddenly stop functioning (just like our local machines).
Appreciate any help on this matter. Thank you!
I also asked this question on Apple developer forums, here is the link: https://forums.developer.apple.com/thread/86762
“Argument list too long” sounds like E2BIG, which you get when you try to run a child process with a huge argument list (I believe the current limit is 256 KiB). I suspect that Export for Localizations is running some sort of command line tool to do that work (probably the extractLocStrings tool, which you’ll find lurking within Xcode’s app bundle) and passing it full paths to each of the files in your project. Depending on how many files you have and how long those paths are, it’s easy to run into problems like this.
One of the ‘fun’ things about bugs like this is that they are dependent on where you place your project. Things might work if the project is at the top of your home directory but fail if it’s nested deep inside a subdirectory.
That also suggests a potential workaround, namely, to move your project further up in the directory hierarchy.
Finally, you should definitely file a bug about this. I believe we’ve seen this before (r. 30703294) but your report will help reinforce that this is causing problems for developers in the field. Please post your bug number, just for the record.
Several days ago before I read this answer, I managed to get the export working by deleting some folders via Xcode (remove references only). Initially I suspected that there's an invalid format within the folders that I deleted, but when I tried deleting other folders, the export process works just fine.
I also tried exporting strings using Xcode 9, and I didn't encounter the problem. So hopefully this bug is only for Xcode 8.3.3 and below.

Reference to xml_****_**** is ambiguous

I have updated my Xcode to the latest version of 8.0
After the update, I am facing a new build error preventing me to run the project on the simulator.
The error is the below in DDXMLNode.m:
reference to 'XML_DOCUMENT_NODE' is ambiguous
I am using the XMPP framework as pods (pod 'XMPPFramework') so I still can't figure out a way to solve this.
Note that the project is working normally on the device and was working on both Device and Simulator with the previous Xcode Version.
I have tried to search the internet but I still didn't find any solution for this.
I tried to clean the project and delete everything in the DerivedData folder as well, but it didn't solve the issue.
Appreciate any help.
Actually I am posting this answer in case it may help someone in the future.
After searching a lot without finding any answer, I discovered the following:
There is a file called module.modulemap that contains 2 methods.
module libxml [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/libxml2/libxml/tree.h"
export *
}
module libxmlSimu [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/libxml2/libxml/tree.h"
export *
}
The first one is used for real devices, the other one for the simulator.
However, when building the app on the simulator, and for a reason that I didnt figure it out, tree.h is being duplicated and causing all these issue.
So what I made to be able to run the project on the simulator was to comment the first method so the app can build successfully.
NB: Don't forget to uncomment the method once you want to run the project again on the real device.
Hope this will help anyone who will face the same issue.
i have tried some way.
I search the word XML_DOCUMENT_NODE with a result here:
then replace every error with the left symbol. It turns out to be OK for me now.

How can you permanently change iOS app configuration in Meteor Cordova?

Every time I meteor build, I have to open XCode and do the following:
remove and add an item from "Link Binary With Libraries" (Facebook SDK)
add a URL Type (custom URL scheme for my app)
add a "Required device capabilities" to "Custom iOS Target Properties"
How can I edit my Meteor project to have these steps done automatically, and to auto add things to AndroidManifest.xml?
In some way use mobile-config.js or cordova-build-override?
I'm happy to see another guy who is trying to build a hybrid application using Meteor / extending a Meteor Cordova iOS app, since I'm facing the very same issues. So I'm very happy to share my experiences and approaches with you. :-)
So far, I ended up with the following approach:
I created a base template for my iOS app using meteor build (not meteor run ios-device, since I did not know if Meteor does some optimizations for production code).
Then, I copied the whole Xcode project under /platforms/ios to another loaction and used this new project as my "master" project from then on. This project is being enriched with native code, e.g. it also includes the Cocoa Pods I'm needing.
Of course, I also did not want to copy files each and every time I trigger a new Meteor build. At least, I would like to have the Staging/www folder updated, as this is happening quite frequently.
So my first (rather naive) approach was
delete the Staging/www folder in the master project
replace it with a relative link (using Xcode's linking functionality) to the Staging/www folder inside the .meteor/local/.../ios/ project
This approach did not work, since the shell script used in the Meteor Xcode project can't handle these links.
My second approach is to create a symlink on the filesystem level instead. This works as it should, and I'm able to build the project in Xcode as it should.
I could have followed the same approach for the Cordova plugins folder, but I've decided to replace the plugins manually in order to get a better control over them, even it means a bit more effort then.
Having the symlink in place also means that Xcode's version management (and also SVN which I am using for everything) will ignore everything below Staging/www, which is good in my opinion, because I'm already versioning the webapp code in the Meteor project itself.
BTW: I've started a discussion thread on hybrid mobile app on the Meteor forums as well, but so far it did not get too much attraction:
https://forums.meteor.com/t/building-a-hybrid-meteor-cordova-app-share-experiences/8212
Maybe we could follow up on Meteor-specific things there, to have the Meteor community participate in the discussion?
EDIT: I would also like to share an approach that failed completely, at least for me, maybe I was too dumb... Before I used Meteor's Xcode template as the starting point, I also tried it "the other way round", i.e. I started with my already existing Xcode app project and tried to include Meteor's / Cordova's part by hand. Using this approach, I never managed to set everything up correctly. I had lots of troubles and also had to tweak a lot of the compiler / linker flags to even get the code compiling. This grew me a lot of gray hairs. But even after I managed to get everything to compile, Meteor hang during startup - and I never figured out why.
One remaining problem I'm still facing is that Meteor's hot code push functionality seems to have some severe issues on iOS, that are also documented as GitHub issues. It can happen that the iOS app gets completely broken and needs to be reinstalled. I tried the mdg:reload-on-resume package, but this did not work as it should and made things even worse. As far as I can tell from the GitHub discussions, one should better disable hot code push until the Meteor team has addressed these issues. Breaking the app completely due to code pushes is not what my users would expect.
Unfortunately plist values (and assumably AndroidManifest.xml as well) can only be changed by a plugin:
Add entry to iOS .plist file via Cordova config.xml

Resources