Add facebook iOS SDK without Xcode for a Phonegap Build app - ios

I've been able to successfully build my iOS app without using Xcode. My app is a collection of HTML, CSS, and Javascript, along with my config.xml that I'm able to compile with Phonegap Build.
The app's basic functionality has been tested on iPhones and works well, but now I want to add a social layer to the app with the FacebookConnect plugin for Phonegap Build. However, the documentation on GitHub requires the app to be setup in Xcode.
Without using Xcode, is there a way to download the SDK (not as a .pkg) and add it to my project files that I upload to Phonegap Build to complile? If so, where do I get the files, which files do I need, and where do I include these files in my project structure?
Here is my current project structure:
-config.xml
-index.html
-includes
--css
--js
Perhaps there is a way of doing this with GitHub, but I've never done pull requests or anything like that. I simply work in my text editor and am not sure how to pull from GitHub.
Phonegap Build Plugins
Thank you for any help you can offer on this!

I have successfully implemented the FacebookConnect Plugin for Phonegap Build on Windows without Xcode.
I recommend just following the instructions on the Phonegap Build Plugins page and ignore the instructions on the GitHub page (which talks about Xcode and other things you don't need for the Build plugin). They have now updated the GitHub page instructions to direct Phonegap Build users away from the GitHub instructions and over to the Phonegap Build Plugins page.
For Step 1 (Setting your app up on facebook), select Native iOS App and the Bundle ID is the same as your "id" in your config.xml (i.e. com.company.appname) and you can set the App Store IDs to "0" while testing.
For Step 2, make sure you use facebook-js-sdk.js. At one time there was a typo.
A good way to test things out is to paste the content of the example Simple app on GitHub into a new index.html file and upload it with your normal config.xml file to Phonegap Build . I did this for one build on my app and then after I tested it, just uploaded my normal index.html file. The only change you will need to make in the index.html of the Example app is to put your Facebook App ID at the bottom in the FB.init function. I also changed response.session to response.authResponse to match the Facebook JS SDK, but I'm not sure if that is necessary.
Be sure to update your config.xml file with everything mentioned in Step 3. I also added the following code:
<access origin="http://m.facebook.com" />
<access origin="http://graph.facebook.com" />
<access origin="http://api.facebook.com" />
<access origin="http://fbcdn.net" subdomains="true" />
<access origin="http://akamaihd.net" subdomains="true" />
The above code is not necessary if you have the following in your config.xml file already:
<access origin="*" />
The FacebookConnect plugin is using the Facebook JS SDK, which you can learn more about here: https://developers.facebook.com/docs/reference/javascript/.
Also, one other issue I ran into that the Phonegap Build Team is working on is that when asking for permissions, you cannot just ask for the Basic Permissions by leaving off the scope option. For now, you must include at least one scope option for the login function to work.
function fbLogin () {
FB.login(function(response) {
if (response.authResponse) {
alert('User Login Success!');
} else {
alert('User cancelled login or did not fully authorize.');
}
}, { scope: "email" });
}
Most developers probably want to ask for more than the Basic Permissions, so this shouldn't be that big of an issue.
My responses above are from discussions about the Facebook Plugin over on the Phonegap Build Support Site. You can learn more about the plugin and current issues and solutions there.
It took me a little while to figure this stuff out, so hopefully this will help others save some time.

Related

How to fix if App rejected for using UIWebView in code?

I have been trying to upload an iOS app to Appstore but its only appearing on "Activity" tab for 3-5 minutes and then disappears.
Then I got an email from Apple saying that my app is rejected because it is using UIWebView in one of the view controller. I deleted that particular screen and reuploaded the app and had the same error email.
Then I checked my third-party sdks like FacebookLoginSDK and GoogleSignInSDK and updated those and then checked that if the app has no UIWebView which it did not. Then i reuploaded the app but this time again I had the same error email. I have searched the whole storyboard source code and the whole app code to look that if there is any sign for UIWebView but there is nothing, but still I am getting this email.
I also tried deleting 'Derived Data' folder several times and cleaning the build folder also but nothing helps.
On the other hand I have uploaded a different app today which had UIWebView and it got approved but I also got the same email for not using UIWebView.
Does anybody had this kind of experience or can anybody tell me whats going on ?
I got the same issue before.
If you have uploaded the build and showing it in activity tab for few minutes then its not mean that issue is only about UIWebview but there can be some other issue as well.
I have uploaded my app n got the mail related to UIWebview, so I coverted the UIWebview to WKWebView and again I uploaded but that time same thing happend.
I failed to tackle the problem.
Then I mailed to Apple Developer Support and they replied like
Any of the third party library internally using some privacy data you should ask permission for the same.
Then I checked Info.plist, I have given each permission in list still how it comes that we don't understand.
Finally then after whole search the one third party library internally using motion related data without permission so this happened.
Then I have added that in plist and then again uploaded and its approved.
So please you can check your info.plist and also check whether your third party library using any privacy sensitive data without permission or not.
May it help you at some point.
Make sure you update all your plugins to the latest version!
Check this: https://ionicframework.com/blog/understanding-itms-90809-uiwebview-api-deprecation where you can find the plugins that have known issues concerning the old WebView usage.
But be aware that uninstalling and re-installing some plugins will NOT will not install the latest available version of the plugin!
So to be sure that you are re-installing the latest version of a plugin, go to the github repository of the cordova plugin and search for the plugin.xml file and open it. Then, copy the version string found in the root xml element.
Finally, install the plugin like that: ionic cordova plugin add plugin_name#copied_version
<?xml version='1.0' encoding='utf-8'?>
<plugin id="cordova-plugin-firebase" version="2.0.5"
xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<name>Google Firebase Plugin</name>
...
...
...
</plugin>
Are you using the AdMob plugin?
It is not enough to check for the absence of "UIWebView" strings!
You have to make sure that all third party plugins are up to date.
One of the trickiest situations I had went to is when I had tried to update an app (using AdMob) on the AppStore after Apple started rejecting apps using the UIWebView.
The generated iOS source code has no UIWebView references, but still rejected!
After a long headache, I realized that the Google AdMob SDK version I'm using is out of date, knowing that I had updated the AdMob plugin from the CLI, but it seems that the SDK is not updated when updating from the npm.
Finally, I had downloaded the latest AdMob SDK from this link https://developers.google.com/admob/ios/download and replaced it in the source code of the AdMob SDK plugin. Then I had followed the instructions found in this link https://developers.google.com/admob/ios/quick-start to update the code in the xCode.

Branch.io Cordova SDK not generating links

I am trying to integrate Branch.io into my mobile app, mostly for the purpose of tracking and rewarding referrals. I have the plugin mostly working, but it is failing at the most important part, generating the links. The app successfully initiates Branch, creates a Universal Object and I get a confirmation alert every time the app opens. It also successfully opens the share sheet when I click the share button and fills in the message text, but it doesn't contain the link. I've also noticed that the Branch.io dashboard is not recognizing that I've integrated the SDK. I am using PhoneGap build 6.2.0 and Cordova Branch SDK version 2.6.0
Here is my the Branch snippet of my config.xml
<plugin name="branch-cordova-sdk" spec="^2.6.0" /><!-- If available via Cordova registry; consider changing to an NPM reference. -->
<branch-config>
<branch-key value="key_live_xxxx" />
<uri-scheme value="xxxx" />
<link-domain value="xxxx.app.link" />
<ios-team-release value="xxxx" />
</branch-config>
And here's a screen shot of the alert after creating a universal object and of the share sheet
Universal Object
Share Sheet
It Is the issue with PGB Service
i had same issue with my project also... i am taking build using phonegap build service. universal object is initializing but the link is not generating.. in ios 9.3 the Share sheet comes. but there is no link . in ios 10 even Share sheet is not opening
Try Using Mac with cordova my issue solved
check this link ..
https://forums.adobe.com/thread/2290461

Xcode .ipa update loop: Update Available, An updated application

Morning Lads/ladies,
Shortest background I can write: In-house application for managing inventory, developer made redundant, no iOS Developers in the company, in comes me. I have no iOS developing experience, limited HTML/Javascript programming background.
App runs on iOS v6.1.6, had to fish out Macbook from '08, now running El Capitan v10.11.6, and xCode v 6.4 (6E35b). I don't know what software/OS versions were used to develop the app/maintain it. Xcode is set to make the Project Format: Xcode 3.2-compatible.
Painfully, I have managed to locate prev. developers xcodeproj file, change to my developer profile for code signing, clean/build/archive/export a .ipa. This installs and the app runs on the intended devices.
Error is: Update Available, An updated application is available and will install now.
Only occurs when the user chooses his user profile (no password, just press User > Userprofile), a store (which section of the warehouse the items are), navigates around the app for a few seconds, presses the Home button and then reopens the application.
Currently, you have to uninstall (regular iOS uninstall)/reinstall via webserver to fix the issue. I have tried removing the files from the webserver after reinstall. The update is still prompted. The update will install the application successfully. If you open the app after this 'update' it will instantly prompt to update again.
My question is, if this isn't too vague, where could I look first to find the cause of this supposed 'loop' of updating?
EDIT1: *****Workflow:******
I've pulled the project file from the depths of the messy Stocktake folder(8 different distributions/versions scattered) using the last modified dates.
After loading the project into Xcode, the first item that demands attention is 'Validate Project Settings'. These including (under the sub-heading, bolded, Build Settings) Target 'StockTake' - Automatically Select Architectures, Project 'StockTake' - Automatically Select Architectures, Project 'StockTake' - Enable build active architecture only when debugging. I perform the changes and enable the subsequent popup asking to create a snapshot.
From the top, Stocktake Info, Deployment target, iOS Deployment Target [6 . 1]
Switch to Identity: Bundle Identifier is correct (has been changed from previous owner, I hack-jobbed this using notepad++ and navigating through the project files looking for anything related to him)
Version: [1.0] (i'll leave it as this this time round)
Build: [1.0]
I also make sure that the correct Team is selected.
BUILD SETTINGS
Architectures: Base SDK [Latest iOS (iOS 8.4)]
Code signing: All either iOS Developer, or automatic.
Everything else is left as it is when I bring up the project file.
Clean, Clean Succeeded
Build, Build Stocktake: Succeeded
Then, Product, Destination, iOS Device
Archive
(Can see Stocktake, creation date, Version is what is listed above [1.0])
Validate, Choose correct team, Provisioning profile is what XC has created
iTunes Store operation failed (No suitable app records were found, check bundle identifier)
I leave this as is because I can use the export function in the organizer successfully anyway.
Export, Save Ad Hoc Dep., Choose correct team, Export with XC-created prov. profile, Export
.ipa is created successfully.
I can go more in-depth, but I don't want to make a MASSIVE wall of text. I can upload a PDF of my in-depth findings somewhere if need be.
-(void) promptForUpdate
{
CCAlertView *alert = [[CCAlertView alloc] initWithTitle:#"Update Available" message:#"An updated application is available and will install now."];
[alert addButtonWithTitle:#"Ok" block:^{
// open update URL in Web Browser
if (![[UIApplication sharedApplication] openURL:kUpdaterURL]) {
ALog(#"Failed to open app updater URL: %#", kUpdaterURL);
}
}];
[alert show];
}
I managed to solve this particular issue, we will see if any more issues pop up. There must have been a version mismatch between the appname.plist, and two web.config files related to an Oracle database this app connects to. We run two Maximo environments here, production and test.
To fix this problem:
I opened appname.plist(Stocktake.plist in my case) and found the following coding:
<key>bundle-version</key>
<string>1.0</string>
I editted this to:
<key>bundle-version</key>
<string>1.16</string>
This was to match the two webconfig files, which looked like this:
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="true" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="MaximoConnection" value="provider=OraOLEDB.Oracle; data source=maximo75test; user id=; password=;" />
<add key="BatchSize" value="200" />
<add key="Version" value="1.16" />
I didn't touch the bundle-version string, because throughout each previous distribution I found, it had been 1.0. I had played around with the web.config Version file before, but was matching it to the App version I was creating in Xcode (I think the last version I tried creating was 1.6). I'm unsure why this worked, I haven't entered 1.16 into any of the .ipas I created, it was 1.16 when I initially started my troubleshooting,but it could have something to do with Maximo (perhaps Maximo is version 1.16?).
If anyone has trouble with this 'Update Available' loop, i'd suggest trying to find the last iteration of whatever application you're working with, and the latest version of the software you're integrating with, and set the version AND build to the same number before you export. It isn't best practice, but at least if you can get it working, you can slowly replace versions/builds until you find the problem.
This post (linked below) helped me come to the conclusion of changing the versions:
Version vs build in XCode

how to add plugin without cli in cordova 3.5.0 iOS

I am not using cli for my cordova project ,i got the cordova 3.5.0 project from there site and integrated with my project.All the custom plugins created by me is working fine.But the API's like device is not accessible.I have added the CDVDevice to config.xml but still i can't able to access the device object.
So please help me to solve this problem.
In order to correctly working the Cordova requires you to have cordova_plugins.js file near the cordova.js. That file contains registration of the JS API.
The easiest part is use Plugman to install plugins inside your custom project, that way, it will handle all work on creation of cordova_plugins.js.
Official Cordova documentation for the Plugman
See the possible related answer Cordova 3.5 embedded webview with plugins where I put more insights about how you could modify cordova_plugins.js in case you desperately need this, but I would recommend you to use Plugman.

InAppBrowser not launching

I've installed Phonegap using the npm and my app is working great, except when I call window.open to launch a website it does not give me the footer with the done button so my app get's stuck on the called web page.
I am using XCode to build an ios app.
I've used npm to add the InAppBrowser plugin. It added the to to the config.xml.
I've added the site to my whitelist in config.xml. The site opens fine, just without the done button/footer.
It added the InAppBrowser plugin entry to:
/#myapp#/platforms/#platform#/www/cordova_plugins.js
It added the InAppBrowser plugin folder in /#myapp#/platforms/#platform#/plugins/
The related SRC files for InAppBrowser are in the platform folder as well
(for example IOS plugin src files are: /#myapp#/platforms/#platform#/#appname#/Plugins/)
I added a console.log function to InAppBrowser.js to confirm that the plugin is loaded, but it does not generate a log entry.
I've tried many things to get the footer/done button to show without any success, but I seem to be missing something here.
I solved this problem by recreating the Xcode project using cordova (instead of phonegap). I went through all of the solutions several times with no luck, so I used the terminal to build a new cordova project, added the InAppBrowser to the project, then copied my code and assets from the old project to the new one. Launched the app on my ipad and it all worked just fine.
I don't suspect it's a problem with Phonegap 3.1.0. I think there was a project issue that kept it from working and starting over with a clean project did the trick.
All is well.
One note is that I saw postings that reported cordova interrupts the console.log function, so be careful with that. Alerts work just fine.

Resources