RubyMotion: Objective-C stub for message `logInWithPermissions:block:' type `v#:##?' not precompiled - facebook

I tried to implement a Facebook login via Parse.com iOS SDK.
When I try to use the PFFacebookUtils.loginWithPermissions:block: method, I got the error.
Objective-C stub for message `logInWithPermissions:block:' type `v#:##?' not precompiled. Make sure you properly link with the framework or library that defines this message.
Anyone experienced this?
I use
rubymotion 2.31
Parse-iOS-SDK 1.2.19 (using cocoapods)
This is my Rakefile:
$:.unshift('/Library/RubyMotion/lib')
require 'motion/project/template/ios'
require 'bundler'
Bundler.require
Motion::Project::App.setup do |app|
app.name = 'myapp'
app.identifier = 'com.your_domain_here.myapp'
app.short_version = '0.1.0'
app.version = app.short_version
app.sdk_version = '7.1'
app.deployment_target = '7.0'
app.icons = ["icon#2x.png", "icon-29#2x.png", "icon-40#2x.png", "icon-60#2x.png", "icon-76#2x.png", "icon-512#2x.png"]
app.device_family = [:iphone]
app.interface_orientations = [:portrait]
app.files += Dir.glob(File.join(app.project_dir, 'lib/**/*.rb'))
app.frameworks += [
'Accounts',
'AudioToolbox',
'CFNetwork',
'CoreGraphics',
'CoreLocation',
'MobileCoreServices',
'QuartzCore',
'Security',
'Social',
'StoreKit',
'SystemConfiguration']
app.libs += [
'/usr/lib/libz.dylib',
'/usr/lib/libsqlite3.dylib']
app.pods do
pod 'SVProgressHUD'
pod 'Parse-iOS-SDK'
end
FB_APP_ID = '<my facebookAppId>'
app.info_plist['FacebookAppID'] = FB_APP_ID
app.info_plist['CFBundleURLTypes'] = [{ CFBundleURLSchemes: ["fb#{FB_APP_ID}"] }]
end
Related code:
def login_with_facebook
PFFacebookUtils.logInWithPermissions(['email'],
block: lambda do |user, error|
if !user
puts 'failed!'
elsif user.isNew
puts 'User signed up and logged in through Facebook!'
else
puts 'User logged in through Facebook!'
end
end
)
end

This is a known bug in the way the Parse SDK bridge files are generated:
http://hipbyte.myjetbrains.com/youtrack/issue/RM-119
Workaround here (for me, I had to do the replacement in the vendor/Pods/build-iPhoneSimulator/Pods.bridgesupport file)
https://groups.google.com/forum/#!msg/rubymotion/36WCWPPkPdc/kBCDS-DOSjsJ

Related

PHP SDK v3 reporting issues

I have downloaded the IPP PHP SDK and am wondering how to make the REST calls for reporting. I am trying to make any REST call and it doesn't seem to work..
I have used the AccountFindAll.php as an example for calling the REST API. I either get nothing back, which makes me think if I am even calling it right, or there is no data returned. I have received an error though for the AgedPayables report saying permission denied. The AccountsFindAll.php example does work and brings me back what I want but it is using some kind of query format.
I would like to use the REST API but I can't get it to work. If anyone can point me in the right direction it would be so appreciated.
Here is my code:
<?php
require_once('config.php');
require_once(PATH_SDK_ROOT . 'Core/ServiceContext.php');
require_once(PATH_SDK_ROOT . 'DataService/DataService.php');
require_once(PATH_SDK_ROOT . 'PlatformService/PlatformService.php');
require_once(PATH_SDK_ROOT . 'Utility/Configuration/ConfigurationManager.php');
//Specify QBO or QBD
$serviceType = IntuitServicesType::QBO;
// Get App Config
$realmId = ConfigurationManager::AppSettings('RealmID');
if (!$realmId)
exit("Please add realm to App.Config before running this sample.\n");
/*
$accessToken = $_REQUEST['accessToken'];
$tokenSecret = $_REQUEST['tokenSecret'];
$realmId = $_REQUEST['realmId'];
*/
$realmId = ConfigurationManager::AppSettings('RealmID');
// Prep Service Context
$requestValidator = new OAuthRequestValidator(ConfigurationManager::AppSettings('AccessToken'),
ConfigurationManager::AppSettings('AccessTokenSecret'),
ConfigurationManager::AppSettings('ConsumerKey'),
ConfigurationManager::AppSettings('ConsumerSecret'));
$serviceContext = new ServiceContext($realmId, $serviceType, $requestValidator);
if (!$serviceContext)
exit("Problem while initializing ServiceContext.\n");
//$httpsUri = "company/".$realmId."/reports/AgedPayables"; //?date_macro=Today
$httpsUri = 'company/'.$realmId.'/companyinfo/'.$realmId;
//$httpsUri = 'company/'.$realmId.'/query';
//$httpsPostBody = 'select * from CompanyInfo startPosition 0 maxResults 500';
$httpsPostBody = NULL;
$httpsContentType = CoreConstants::CONTENTTYPE_APPLICATIONTEXT;
$requestParameters = new RequestParameters($httpsUri, 'GET', $httpsContentType, NULL);
$restRequestHandler = new SyncRestHandler($serviceContext);
list($responseCode, $responseBody) = $restRequestHandler->GetResponse($requestParameters, $httpsPostBody, NULL);
$parsedResponseBody = NULL;
try {
$responseXmlObj = simplexml_load_string($responseBody);
if ($responseXmlObj && $responseXmlObj->QueryResponse)
{
$responseSerializer = CoreHelper::GetSerializer($serviceContext, false);
$parsedResponseBody = $responseSerializer->Deserialize($responseXmlObj->QueryResponse->asXML(), FALSE);
}
}
catch (Exception $e) {
echo $e->getMessage();
IdsExceptionManager::HandleException($e);
}
print_r($parsedResponseBody);
?>
I get an XML response to report queries.
Please refer:
https://developer.intuit.com/blog/2014/03/25/the-quickbooks-online-reports-api-has-arrived
PHP SDK does not support Reports at this time.

Share an app with Friends with Corona sdk free version

I am trying to share my app created in corona sdk free version in facebook. But no working example found on internet. It seems there is a change in facebook api or policy. Does any one have created app in corona sdk with facebook integration recently ? Can any one provide me referece to the way we can integrate the facebook.
I found another question sharing my app through facebook in corona Sdk but the link provided in answer is down. It would be greate= help.
Is there any update in facebook API ? as I am getting response null every time. can any one provide working example reference created recently ?
I tried the example provided by krs in following answer but it is not working for me.
https://developer.coronalabs.com/content/facebook
when I click on any of the feature like post Msg it goes to facebook page and after some processing it directly comes to the home page again nothing gets done. In log I ma getting response null.
following is screenshot of error.
any help will be great help to me.
EDIT
I had tried a lot but the same issue is there. I think facebook app configuration problem is there.
Can anyone provide detailed step by step information to configure an app and generate build in corona ? I am giving another 100 point bounty for this.
I hope this helps make a lua file and copy this code name it whatever you want
local facebook = require "facebook"
local json = require "json"
local _M = {}
local appId = "" -- put your app id string here
local message = ""
local access_token = ""
local fbCommand = ""
local LOGOUT = 1
local SHOW_DIALOG = 2
local POST_MSG = 3
local POST_PHOTO = 4
local GET_USER_INFO = 5
local GET_PLATFORM_INFO = 6
function showPopup(popupTitle,popupMessage)
native.showAlert( popupTitle, popupMessage, {"OK"} )
end
function listener( event )
if ( "session" == event.type ) then
if ( "login" ~= event.phase ) then
showPopup("Facebook share score failed!", "Please try again")
return
end
print(access_token)
access_token = event.token
if fbCommand == GET_USER_INFO then
facebook.request("me")
elseif fbCommand == POST_MSG then
facebook.request("me/feed", "POST" , {message = message} )
end
elseif ( "request" == event.type ) then
local response = event.response
print("Response: ",response)
if ( not event.isError ) then
if fbCommand == GET_USER_INFO then
response = json.decode( event.response )
elseif fbCommand == POST_MSG then
showPopup("Facebook share score", "You've successfully shared your score!")
end
else
showPopup("Facebook share score failed!", "Please try again")
end
end
end
function _M:postToWall(msg)
message = msg
fbCommand = POST_MSG
facebook.login( appId, listener, {"publish_stream"} )
end
function _M:shareGame()
message = "Juggler http://google.com/"
fbCommand = POST_MSG
facebook.login( appId, listener, {"publish_stream"} )
end
return _M
and when you want to share on use this function
local function FacebookShare(event)
if event.phase == "began" then
local FBManager
local message
FBManager = require( "Facebook" )
message = "" -- your message
FBManager:postToWall(message)
end
end
if user is not login it will call login facebook.
this works for me hope it solve your problem
There is facebook sample app from ansca labs. See that from the link below:
https://developer.coronalabs.com/content/facebook
And there is an integration in the app Ghosts-vs.-Monsters
https://github.com/ansca/Ghosts-vs.-Monsters
Keep coding......... :)

PayPalAPIInterfaceServiceService::SetExpressCheckout() returns null response object

I'm using Yii to build an application that requires payments through PayPal. After a lot of digging, I found that ExpressCheckout is the method to use. The code below worked fine some time ago (some (?) weeks ago, I suppose before PayPal rolling out their new developer platform), using version 1.2.95 of the PHP SDK. Now, using the latest version v.2.2.98, the code fails.
require_once(Yii::getPathOfAlias('application.libraries.paypal') . '/PPBootStrap.php');
$logger = new PPLoggingManager('SetExpressCheckout');
$PaymentDetails = new PaymentDetailsType();
$PaymentDetails->OrderTotal = $PaymentDetails->ItemTotal =
new BasicAmountType('USD', $subscription->price);
$PaymentDetails->PaymentAction = "Sale";
$PaymentDetails->OrderDescription = $subscription->description;
$setECReqDetails = new SetExpressCheckoutRequestDetailsType();
$setECReqDetails->PaymentDetails[0] = $PaymentDetails;
$setECReqDetails->CancelURL = 'someCancelUrl';
$setECReqDetails->ReturnURL = 'someReturnUrl';
$setECReqType = new SetExpressCheckoutRequestType();
$setECReqType->SetExpressCheckoutRequestDetails = $setECReqDetails;
$setECReq = new SetExpressCheckoutReq();
$setECReq->SetExpressCheckoutRequest = $setECReqType;
$paypalService = new PayPalAPIInterfaceServiceService();
$ok = TRUE;
try {
$setECResponse = $paypalService->SetExpressCheckout($setECReq);
if($setECResponse && strtoupper($setECResponse->Ack) =='SUCCESS') {
$token = $setECResponse->Token;
// Redirect to paypal.com here
$this->redirect(
'https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=' . $token);
}
}
catch (Exception $ex) {
Yii::trace(__METHOD__ . ': Exception while interacting with PayPal API, error: '
. $ex->getMessage());
$ok = FALSE;
}
The offending line is:
$setECResponse = $paypalService->SetExpressCheckout($setECReq);
In PayPalAPIInterfaceServiceService::SetExpressCheckout(), these two lines:
$resp = $this->call('PayPalAPIAA', 'SetExpressCheckout', $setExpressCheckoutReq, $apiCredential);
$ret->init(PPUtils::xmlToArray($resp));
are the issue. $resp is null, so the next line fails at the PPUtils::xmlToArray($resp) method call.
Obviously, either I'm missing something here, or PayPal does something wrong.
Any help?
After a lot of debugging, the cause of the issue was that the service.EndPoint.PayPalAPI parameter was not defined in sdk_config.ini. For some reason that I don't recall, this parameter was deleted from the working config file from the previous version.
Now, the express checkout method works fine, even with the latest 2.3.100 version of the API.

Setting env when using rspec to test omniauth callbacks

I'm having a strange problem when trying to set a callback for Facebook Authentication via Omniauth. In my controller (simplified to just the code necessary to show the error) I have:
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def facebook
raise env.inspect
# auth_hash = env["omniauth.auth"]
end
end
this works in production mode, showing me the hash. However in test mode env is set to nil.
I have the following set in my spec_helper.rb file
OmniAuth.config.test_mode = true
OmniAuth.config.add_mock(:facebook, {"credentials" => {
"token" => "foo-token"
}
})
and my spec looks like this:
require 'spec_helper'
describe Users::OmniauthCallbacksController do
describe "Facebook" do
before(:each) do
request.env["devise.mapping"] = Devise.mappings[:user]
request.env["omniauth.auth"] = OmniAuth.config.mock_auth[:facebook]
end
it "should be a redirect" do
get :facebook
response.should redirect_to(root_path)
end
end
end
Can anyone enlighten me on what I need to do to have env not be nil when running my tests?
I use the following in my spec_helper.rb :
RACK_ENV = ENV['ENVIRONMENT'] ||= 'test'
I don't use Rails or Devise though so YMMV. I've also seen various threads saying that someone had to do this before their requires to get it to work.

500 error when calling webservice through rhosync/rhodes

I am trying to call a web service in rhosync application.rb, I see a 500 error response in rhosync console .. and 'server returned an error' in BB simulator .. :(
Some info about my setup -
I have created a rhodes app that connects to a rhosync app when user enters user name and password and clicks on "login". I am calling this webservice through "authenticate" method of application.rb of the rhosync application ..
def authenticate(username,password,session)
Rho::AsyncHttp.get(:url => 'http://mywebserviceURL',:callback => (url_for :action => :httpget_callback),:callback_param => "" )
end
UPDATE
Instead of http:async, I tried consuming a soap based webservice and it worked just fine .. here is code if anyone cones here in search of a sample.. in application.rb of rhosync app
require "soap/rpc/driver"
class Application < Rhosync::Base
class << self
def authenticate(username,password,session)
driver = SOAP::RPC::Driver.new('http://webserviceurl')
driver.add_method('authenticate', 'username', 'password')
ret=driver.authenticate(username,password)
if ret=="Success" then
true
else
false
end
end
end
Application.initializer(ROOT_PATH)
You can typically find the problem if you crank up your log. Edit rhoconfig.txt in your app
set these properties -
# Rhodes runtime properties
MinSeverity = 1
LogToOutput = 1
LogCategories = *
ExcludeLogCategories =
then try again and watch the terminal output. Feel free to post the log back and I'll take a look.
You also might want to echo out puts the mywebserviceURL if you're using that as a variable, I trust you just changed that for the post here. Can you access the webservice if you hit it with a browser?
require "soap/rpc/driver"
class Application < Rhosync::Base
class << self
def authenticate(username,password,session)
driver = SOAP::RPC::Driver.new('http://webserviceurl')
driver.add_method('authenticate', 'username', 'password')
ret=driver.authenticate(username,password)
if ret=="Success" then
true
else
false
end
end
end
Application.initializer(ROOT_PATH)
in this what is done in add_method and authenticate method and where it to be written.