Phonegap doesn't copy plugin files to ios platforms directory during build - ios

rm -rf plugins/*
rm -rf platforms/*
phonegap build ios //this works
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
phonegap build ios
Building for ios after adding a plugin fails. Here is the error:
** BUILD FAILED **
The following build commands failed:
CompileC build/PondMD.build/Debug-iphoneos/PondMD.build/Objects-normal/armv7/CDVDevice.o PondMD/Plugins/org.apache.cordova.device/CDVDevice.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
2014-01-16 10:32:15.055 xcodebuild[69605:1007] [MT] PluginLoading: Required plug-in compatibility UUID 37B30044-3B14-46BA-ABAA-F01000C27B63 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XCode4_beginning_of_line.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2014-01-16 10:32:16.630 xcodebuild[69605:4203] DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3575/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:78
Details: Failed to load dependencies output contents from ``/Users/william/working/PhonegapPondMD/platforms/ios/build/PondMD.build/Debug-iphonesimulator/PondMD.build/Objects-normal/i386/CDVDevice.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “CDVDevice.d” couldn’t be opened because there is no such file." UserInfo=0x7fe7a57a7440 {NSFilePath=/Users/william/working/PhonegapPondMD/platforms/ios/build/PondMD.build/Debug-iphonesimulator/PondMD.build/Objects-normal/i386/CDVDevice.d, NSUnderlyingError=0x7fe7a57aaed0 "The operation couldn’t be completed. No such file or directory"}. User info: {
NSFilePath = "/Users/william/working/PhonegapPondMD/platforms/ios/build/PondMD.build/Debug-iphonesimulator/PondMD.build/Objects-normal/i386/CDVDevice.d";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}.
Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *__strong, F) [F = <lambda at /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3575/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:168:73>]
Thread: <NSThread: 0x7fe7a57ab420>{name = (null), num = 7}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
The issue seems to be that phonegap is not copying the objective-c classes and headers into /platforms/ios/
william-macbook-pro:PhonegapPondMD william$ ls -l plugins/
total 8
-rw-r--r-- 1 william staff 296 Jan 16 10:32 ios.json
drwxr-xr-x 11 william staff 374 Jan 16 10:30 org.apache.cordova.device
william-macbook-pro:PhonegapPondMD william$ ls -l platforms/ios/PondMD/Plugins/
total 8
-rw-r--r-- 1 william staff 890 Jan 16 10:30 README
william-macbook-pro:PhonegapPondMD william$ phonegap -v
3.3.0-0.18.0

I had the same problem, and I solved It creating the project with uppercase in the first letter of project name. Yes, it seems incredible, but this was the solution.

I ran into the same issue and solved it by using the instructions here: Cordova 3.2 ios add plugin "Which config.xml? Where is it?"
To summarize, I did the following steps:
1. Removed ios platform via: cordova platform remove ios
2. Re-installed the plugin
3. (Re-)Added the ios platform via: cordova platform add ios
4. Built the project again
After this, it built just fine.

When I added the plugin using cordova plugin add command, it puts the plugin code inside a plugins folder.
When you inspect the plugin folder inside the ios platform, you would see the plugin is not available.
So I created a folder with the same name as the plugin name and copied the files from the plugin src/ directory into this. After this the project built correctly.
I also found it useful to open the native project in xcode to inspect the project closer.

I went with the solution to copy the plugin files from ./plugins/.. to the ios platform plugin directory. Whoever needs it, here is a little helper for gulp.
(npm install gulp gulp-rename)
(gulpfile.js)
var gulp = require("gulp");
var rename = require("gulp-rename");
gulp.task("cp-plugins-ios", function(){
gulp.src(["./plugins/*/src/ios/*"],{base: 'ios'}).pipe(rename(function(path){
var myDir = path.dirname.replace("src/ios","");
path.dirname = myDir;
})).pipe(gulp.dest("./platforms/ios/projectName/Plugins/"));
});

Related

error: /.../node_modules/native-base/Fonts/rubicon-icon-font.ttf: No such file or directory

I'm having error building a fresh ios cloned repository. Days before this, it was working fine. Now I tried re-installing the native-base or removing node_modules and doing npm install again. But still having the error:
2018-05-10 12:07:07.983 xcodebuild[71799:432389] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-14095/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/BuildSystem/Runtime/PBXTargetBuildContext.mm:757
Details: unexpected successful exit code from cancelled command <C0038:'CpResource Lato-Bold.ttf':P10>
Object: <PBXTargetBuildContext: 0x7fd2dfe53830>
Method: -createCommandInvocationRecordFromInvocation:
Thread: <NSThread: 0x7fd2df8641a0>{number = 3, name = (null)}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
** BUILD FAILED **
The following build commands failed:
CpResource /Users/sample_user/Documents/repos/mobile/node_modules/native-base/Fonts/rubicon-icon-font.ttf build/Build/Products/Debug-iphonesimulator/sampleApp.app/rubicon-icon-font.ttf
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/sampleApp.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/sampleApp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Here are my versions:
react-native-cli: 2.0.1
react-native: 0.47.2
"native-base": "^2.3.1",
pod version: 1.4.0
Have I missed anything?
I still got unexplainable errors after so I solved this by manually downloading rubicon-icon-font.ttf and pasted it in node_modules\native-base\Fonts\
This is fixed on master, you can find it in today's release
https://github.com/GeekyAnts/NativeBase/issues/1850
I got this error after I upgraded Native Base. The solution was to delete the missing files from XCode under Resources.

Facebook sdk not working if I place the sdk folder inside react-native project?

I am wanting to manually link the Facebook SDK because we don't use cocoapods & don't want to implement it. But for some reason when we build our app on buddybuild, it will fail.
What I've done is placed the FacebookSDK folder inside (not an optimal solution I know):
ios/<ProjectName>/FacebookSDK
I added this folder ($(SRCROOT)/ios/<ProjectName>/FacebookSDK) to the framework search header paths & it still seems to throw errors.
1850
▸ Compiling RCTFBSDKShareDialog.m
1851
» In file included from node_modules/react-native-fbsdk/ios/RCTFBSDK/share/RCTFBSDKShareDialog.m:19:
1852
✗ node_modules/react-native-fbsdk/ios/RCTFBSDK/share/RCTFBSDKShareDialog.h:21:9: fatal error: 'FBSDKShareKit/FBSDKShareKit.h' file not found
1853
» #import <FBSDKShareKit/FBSDKShareKit.h>
1854
» ^
1855
▸ Compiling RCTFBSDKAppEvents.m
1856
» In file included from node_modules/react-native-fbsdk/ios/RCTFBSDK/core/RCTFBSDKAppEvents.m:19:
1857
✗ node_modules/react-native-fbsdk/ios/RCTFBSDK/core/RCTFBSDKAppEvents.h:21:9: fatal error: 'FBSDKCoreKit/FBSDKCoreKit.h' file not found
1858
» #import <FBSDKCoreKit/FBSDKCoreKit.h>
1859
» ^
1860
** BUILD FAILED **
1861
The following build commands failed:
1862
CompileC /tmp/sandbox/582d62aa1d76fc0100f1f6dd/bbbuild/Build/Intermediates/RCTFBSDK.build/Release-iphoneos/RCTFBSDK.build/Objects-normal/armv7/RCTFBSDKAppEvents.o RCTFBSDK/core/RCTFBSDKAppEvents.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
1863
(1 failure)
Any ideas to what I can do? It'd be nice if we could use this solution for now so that all developers (and the buddybuild CI) can pull it instead of having to download the SDK and put it documents folder.
This is generally a result of an incorrectly configured repository with regards to the location of FBSDK dependencies.
If you take a look at: https://github.com/facebook/react-native-fbsdk/blob/master/ios/RCTFBSDK.xcodeproj/project.pbxproj
You will notice that RCTFBSDK will look for dependencies in one of two locations:
~/Documents/FacebookSDK
$(PROJECT_DIR)/../../../ios/Frameworks
The second option is the correct option for continuous integration systems like buddybuild.
In other words, you MUST place your FBSDK dependencies under the "ios/Frameworks" folder in order for it to work on a continuous integration system.
You can find more information about this in our react-native documentations.
Please let me know if this helps!

React Native: Bundle Identifier does not exist

I have a project in React Native that has two different build schemes and uses cocoapods. To compile it I run:
react-native run-ios --scheme="RNProject-(SCHEME_NAME)"
The resulting apps are for example:
./build/Build/Products/Debug/iphonesimulator/RNProject-customer1.app
./build/Build/Products/Debug/iphonesimulator/RNProject-customer2.app
Using the command it builds for one of the build schemes, but not for the other
Xcode always builds the project for both build schemes
Furthermore, build/Build/Products/Debug-iphonesimulator/RNProject-customer1.app/Info.plist exists in that path and the file contains valid CFBundleIdentifier (it matches General > Identity > Bundle Identifier for each of the two build schemes)
Project settings seem to be correct for both schemes (after checking ios/RNProject.xcodeproj/project.pbxproj)
Schema-specific settings are located in ios/Pods/Target Support Files/Pods-RNProject-customer1 and ios/Pods/Target Support Files/Pods-RNProject-customer2
I tried different ways to solve it:
Running sudo react-native
Restarting RN packager
Manually editing Info.plist
Changing build locations
Console:
** BUILD SUCCEEDED **
Installing build/Build/Products/Debug-iphonesimulator/RNProject.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
child_process.js:509
throw err;
^
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/RNProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:486:13)
at Object.execFileSync (child_process.js:506:13)
at ChildProcess.xcodeBuildProcess.on.code (node_modules/react-native/local-cli/runIOS/runIOS.js:109:36)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:852:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
The problem was with how React Native names labels the executable files.
My Xcode project created two executable files with different names based on Xcode project settings.
React Native on the other hand forms the executable filename from .xcworkspace filename in this script (./node_modules/react-native/local-cli/runIOS/runIOS.js:57):
const inferredSchemeName = path.basename(xcodeProject.name, path.extname(xcodeProject.name));
The two approaches are different and lead to two different executable file names (e.g. Xcode build/Build/Products/Debug-iphonesimulator/RNProject-customer1.app vs React Native build/Build/Products/Debug-iphonesimulator/RNProject.app).
I had set custom value for inferredSchemeNameto match the filename created by Xcode.
My solution is similar:
open ./node_modules/react-native/local-cli/runIOS.js file
change the build path from:
const getBuildPath = function(configuration = 'Debug', appName, isDevice) {
return `build/Build/Products/${configuration}-${isDevice ? 'iphoneos' : 'iphonesimulator'}/${appName}.app`;
};
to
const getBuildPath = function(configuration = 'Debug', appName, isDevice) {
return `build/Build/Products/${configuration}-${isDevice ? 'iphoneos' : 'iphonesimulator'}/${appName}.app`;
};
remove "Build" in the path.
I'm using Xcode-beta 8.2

LibGDX : iOS error=2, No such file or directory

I am trying out LibGDX on a Mac with the aim to build helloworld for iOS. It works on Android, Desktop etc.
I am using Android Studio 1.3, I have xcode 6.4 with command line (plus xcode 7 beta 3). I try to build and run the project and I keep getting. I have updated to the latest Unity(not sure why that would be needed)
Caused by: java.io.IOException: Cannot run program "2015-07-15 15:13:08.572 xcodebuild[697:11725] [MT] PluginLoading: Required plug-in compatibility UUID 7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Unity4XC.xcplugin' not present in DVTPlugInCompatibilityUUIDs
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++": error=2, No such file or directory
at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:246)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:302)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:149)
at org.robovm.compiler.util.Executor.exec(Executor.java:344)
at org.robovm.compiler.util.ToolchainUtil.link(ToolchainUtil.java:367)
at org.robovm.compiler.target.AbstractTarget.doBuild(AbstractTarget.java:229)
at org.robovm.compiler.target.ios.IOSTarget.doBuild(IOSTarget.java:341)
at org.robovm.compiler.target.AbstractTarget.build(AbstractTarget.java:223)
at org.robovm.compiler.Linker.link(Linker.java:424)
at org.robovm.compiler.AppCompiler.compile(AppCompiler.java:462)
at org.robovm.gradle.tasks.AbstractRoboVMTask.build(AbstractRoboVMTask.java:106)
... 67 more
Caused by: java.io.IOException: error=2, No such file or directory
... 79 more
Any help would be awesome as I have been searching the net.
So this turns out to be because I have Unity installed and it installs a plugin Unity4XC.xcplugin which messes it up!

'FacebookSDK/FacebookSDK.h' file not found

I already installed the latest version of phonegap-facebook-plugin
But when i build the project, I got the error message below.
I tried many solutions mentioned at stackoverflow and other websites with no positive result.
com.phonegap.plugins.facebookconnect/FacebookConnectPlugin.m:11:
Et3arrafApp/Plugins/com.phonegap.plugins.facebookconnect/FacebookConnectPlugin.h:11:9: fatal error:
'FacebookSDK/FacebookSDK.h' file not found
#import <FacebookSDK/FacebookSDK.h>
^
1 error generated.
** BUILD FAILED **
The following build commands failed:
CompileC build/Et3arrafApp.build/Debug-iphonesimulator/Et3arrafApp.build/Objects-normal/i386/FacebookConnectPlugin.o Et3arrafApp/Plugins/com.phonegap.plugins.facebookconnect/FacebookConnectPlugin.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Error: /Users/apple/Desktop/et3arraf/platforms/ios/cordova/build: Command failed with exit code 65
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
I encountered the same problem today.
Installing this plugin using the plugin register does not work (for iOS) at the moment.
You must clone the repository (phonegap-facebook-plugin) to your local file system, say $HOME/src/phonegap-facebook-plugin. And then install the plugin pointing to that path, e.g. cordova plugin add $HOME/src/phonegap-facebook-plugin
...
It turns out that FacebookSDK.framework isn't installed properly when fetching through the plugin registry. It should look like this:
$ ls -l plugins/com.phonegap.plugins.facebookconnect/platforms/ios/FacebookSDK.framework/
total 24
lrwx------ 1 mjl staff 24 Aug 15 15:23 FacebookSDK -> ./Versions/A/FacebookSDK
lrwx------ 1 mjl staff 20 Aug 15 15:23 Headers -> ./Versions/A/Headers
lrwx------ 1 mjl staff 22 Aug 15 15:23 Resources -> ./Versions/A/Resources
drwx------ 4 mjl staff 136 Aug 15 15:23 Versions
But the symlinks aren't preserved when installing through the plugin registry... They are preserved when installing from the local file system though.
I had solved it by installing the plugin using --save option.
in my case I had downloaded the plugin to my computer and what I did is :
cordova plugin add --save <my downloaded plugin directory> --variable APP_ID=<app_id> --variable APP_NAME=<app_name>
The required file will be listed same as #mjl's result from ls -l plugins/com.phonegap.plugins.facebookconnect/platforms/ios/FacebookSDK.framework/
P/S: if you are using iTerm, you can drag the folder into your iTerm terminal and the full directory path will be type in automatically.
After more and more search around the web, I tried to re create the sym link of Headers, FacebookSDK and Resources and resolved
ln -s ./Versions/A/Headers Headers
and so on

Resources