.mm .h .c Files from copied phonegap project not shown in Xcode - ios

I have a phonegap project and split the code in global files (that are similar for android and ios) and ios/android specific files. Then I have an ant script where I merge the files into one project again.
The problem is I have a plugin "xzing barcode scanner". The files lay within the projectname/Plugins folder of the IOS project. The files are also merged to the target directory, but in xcode they´re not shown. And when I run the app I get the error that the plugin isn`t known.
This part of the ant scirpt copies the file
<copy todir="${targetdir}/${projectName}.xcodeproj">
<fileset dir="${projectroot}/${projectName}.xcodeproj"/>
</copy>
<copy todir="${targetdir}/${projectName}">
<fileset dir="${projectroot}/${projectName}"/>
</copy>
The contents of the Plugin Folder:
CDVBarcodeScanner.mm
zxing_all_in_one.h
zxing_all_in_one.c
README
All Files are copied to the target directory (targetdir/projectname/Plugins), but somehow not merged into the project in xcode.
Anyone knows how to fix this?

Your files do not seem to be referenced to your XCode project.
I think a simple way you may try would be to copy your files manually like this (I don't know why but this kind of issue was solved for me like this XD...):
Use your Finder to go to your folder Plugin and move the "hidden" files (CDVBarcodeScanner.mm, zxing_all_in_one.h, zxing_all_in_one.c, and README) somewhere else, on your Desktop for instance.
Open XCode and create an empty file for the folder Plugin (--> Through XCode: right click on the folder Plugin, New File...->iOS->Other->Empty) and save the file as CDVBarcodeScanner.mm (for example)
Open the file CDVBarcodeScanner.mm (for example), that you put on your Desktop for example, with a simple text editor and copy the content to your new created file in XCode
Do the same for the remaining files:
zxing_all_in_one.h
zxing_all_in_one.c
README
Hope this solution will work for you. Let me know of your results.

Related

How to hide path inside Swift Package from Project Navigator managed by XCode?

I've created Swift package, which contains a folder with an example project. Its path is not included in any target sources. Nonetheless, after opening Package.swift file in XCode, Project Navigator still shows not included paths. How to hide that obsolete folder?
As I suppose, it is unlikely that XCode manages Navigator contents using an exclusion path from target configuration. It shows not only files specified in targets but all files included in root path. It is reasonable because the package can contain a readme file that can be edited by XCode, however it is not reasonable for files of the example project.
You can make your folder hidden in your Swift Package by adding . at the begin of its name and the Project Navigator doesn't show it because by default, folders with periods at the beginning of their names are hidden in OS X and XCode as well e.g.: .RxStormExample.

Unity: resources.bundle isn't added to xcode

I used to copy/paste my IOS plugin files inside Plugins/IOS folder on my Unity project, but it doesn't work for bundles (as it has directory structure).
I can't beleave there is no way to generate xcode project from unity with .bundle inside?
Any help appreciated
Unity3D will not contains folders in the Plugins/iOS to Xcode project. In fact Unity3D will only auto merge source file and .a library for you, as described by Unity3D's doc:
Automated plugin integration Unity iOS supports automated plugin
integration in a limited way. All files with extensions
.a,.m,.mm,.c,.cpp located in the Assets/Plugins/iOS folder will be
merged into the generated Xcode project automatically. However,
merging is done by symlinking files from Assets/Plugins/iOS to the
final destination, which might affect some workflows. The .h files are
not included in the Xcode project tree, but they appear on the
destination file system, thus allowing compilation of .m/.mm/.c/.cpp
files.
Note: subfolders are currently not supported.
But you can use the PostprocessBuildPlayer attribute to implement this yourself. I made a tool for this purpose called XUPorter, which can make exporting and libraries setting easier from Unity3D to Xcode. You may want to see it on GitHub. There is a demo in the package and you may set your bundle under the 'folders' tag.

move an xcode 4.5.1 project to different folder

I have created a rather large application in xcode and wish to move the files somewhere else on my computer.
Could this process be as simple as dragging the project folder to a different place in finder or will something mess up?
Moving the .xcodeproj files will not cause any issues as long as xcode is closed when you migrate the files and you delete the old files.
When xcode is next launched, if you browse and open the proj file from the new directory, all the references will be set to the correct destinations
on a side note it always pays to keep the old files in a .old folder when migrating projects to avoid issues.
As long as the files are kept in their respective folders, next time you run a build in xcode, the references to the new directory the proj file is in will be updated.
As another side note, i just tried to do this and it messed up for me. Typically, any references will switch over, but i had a linker error: ld. it was trying to link to an external library that was contained within the old folder. i had to go to build settings->search paths->library search paths and change that to the new folder location. that worked for me.

Cocos2D file not found?

I downloaded cocos2d, the latest version. I added the folders 'cocos2d' 'cocosdenshion' 'external' 'cocoslive' and 'experimental' to my project folder, then I dragged them to my project without clicking add to destination group project button.
But when I build the project, I get an error: 'vorbis/ivorbiscodec.h' file not found in ivorbisfile_example.c on this line:
#include <vorbis/ivorbiscodec.h>
If I comment it out, then this line has the same type of warning:
#include <vorbis/ivorbisfile.h>
I can't comment that out otherwise there is like 50 errors!
Anyway, I look in the hierarchy of folder and the file is indeed there. I am not sure what the vorbis/ part is but the file ivorbiscodec.h is indeed in the project and in finder of the projects folder.
I deleted the Box2D and Chipmunk folders in the external folder in finder and in the project if that makes any difference.
Does anyone have any idea why I am getting this error?
Thanks!
Just to make something sure: Did you check 'Copy items to destinations group's folder (if needed)'?
I deleted the Box2D and Chipmunk folders in the external folder in finder and in the project if that makes any difference.
This statement then makes a lot of sense, because the files couldn't be located and it would throw the errors.
(You could also right click the files inside Xcode and hit Show in Finder to verify their existence.
But on a side note: Cocos2D comes with a install-templates.sh script that you can use to natively include some Cocos2D project templates in Xcode. I would recommend you to do that and create Cocos2D projects from inside Xcode as follows:

Team Build, copy file target issue

I have this team build target setup to after compile
<Target Name="AfterCompile">
<Copy SourceFiles="$(SolutionRoot)\Development_VS2008\MyCompanyName.SharePoint.12" DestinationFolder="c:\testing"></Copy>
</Target>
I want the folder structure copied from source to destination...
Amazingly I am getting this error
Could not copy the file "C:\TFS\NightlyBuild\Sources\Development_VS2008\MyCompanyName.SharePoint.12\"
to the destination file "c:\testing\", because the destination is a folder instead of a file.
To copy the source file into a folder, consider using the DestinationFolder parameter instead of DestinationFiles.
As you can see I am indeed using the destinationfolder parameter, does anyone know what I am doing wrong?
I think it might be just because SourceFiles is a directory rather than the files you want to copy. Try this:
<Target Name="AfterCompile">
<ItemGroup>
<FilesToCopy Include="$(SolutionRoot)\Development_VS2008\MyCompanyName.SharePoint.12\**\*.*"/>
</ItemGroup>
<Copy SourceFiles="#(FilesToCopy)" DestinationFolder="c:\testing\%(RecursiveDir)"/>
</Target>
This error happened to me not under Team Foundation project, but standalone one, and when I add new .dll file with build action ContentWithTargetPath. I wanted this library to be included in my output directory. Record for this action appears in one of the ItemGroup section in .csproj file like:
<ContentWithTargetPath Include="Resources\Libraries\libName.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</ContentWithTargetPath>
But for some reason this is not enough to ContentWithTargetPath option works fine (I saw the explanation about it somewhere in StackOverflow, but don't remember where). You should manually add TargetPath subsection to ContentWithTargetPath like this:
<ContentWithTargetPath Include="Resources\Libraries\libName.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libName.dll</TargetPath>
</ContentWithTargetPath>
TargetPath subsection doesn't appear by IntelliSense while editing the .csproj file in Visual Studio, as well as it doesn't appear in libName.dll's properties window, so you should add this subsection by hand. This scenario comes out even in my Visual Studio Community 2017.
PS. You can edit .csproj file while in Visual Studio - unload this project and choose "Edit YourProjectName.csproj" option (right mouse click on unloaded project). Edit and save .csproj file, then reload the project.
You need something such as this:
<CreateItem Include="someFolder\**\*.*">
<Output ItemName="files" TaskParameter="Include" />
</CreateItem>
<Copy SourceFiles="#(files)" DestinationFiles="#(files->'C:\folder\%(relativedir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
Or alternatively I've found the easiest way (if you want to be a bit more stringent about what to include/ exclude) is with some custom MSBuild tasks I've written: http://www.aaron-powell.com/blog.aspx?cat=AaronPowell.MSBuild.Tasks
You provide a source directory, a destination direction (support for network shares is provided) and file names/ extensions to exclude.
It's mainly because Team Build makes a real mess (particularly with web apps) when it run and it's not really possible to use the standard MSBuild copy tasks.
We are experiencing a lot of problems with postbuild xcopy commands. And we decided to avoid xcopy commands.
We are now including the files (which we want to copy) into project, and we are setting copy local property to "Copy if newer" and target directory (directory structure must be same in project)
It helps a lot.
Maybe it also fit your situation.
Copy task doesn't support copying directories apparently (as it's based on 'copy'), and xcopy will fails sometimes due to long filenames in source (>256 characters).
I did this (with robocopy):
<Exec WorkingDirectory="$(MSBuildProjectDirectory)"
Command='robocopy $(MSBuildProjectDirectory)\Main $(DropLocation) /S /COPY:DATS /NP /NFL /NDL /v' ContinueOnError="true" />
I had exactly the same message:
Error 103 Could not copy the file "obj\Release\xxxx.dll" to the destination file "bin\Release\xxxx.dll", because the destination is a folder instead of a file. To copy the source file into a folder, consider using the DestinationFolder parameter instead of DestinationFiles. xxxx
It happened (I don´t know why) that I had in the release folder another folder with the same name of the assembly (including extension), so Visual Studio could not create the assembly there. It is not a configuration in the project or solution, so I just deleted the folder (that I don´t know how it was created) and it worked.

Resources