Search code examples
facebookparse-platformrubymotion

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


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

Solution

  • 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