Class: AppDelegate

Inherits:
Object
  • Object
show all
Defined in:
app/app_delegate.rb

Instance Method Summary collapse

Instance Method Details

#application(application, didFinishLaunchingWithOptions: launchOptions) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/app_delegate.rb', line 3

def application application, didFinishLaunchingWithOptions: launchOptions
  @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)

  @controller = UIViewController.alloc.initWithNibName(nil, bundle:nil)

  @window.rootViewController = @controller
  @window.makeKeyAndVisible

  @label = UILabel.alloc.initWithFrame [ [10,10], [300,100] ]
  @label.setAccessibilityLabel 'username'
  @label.setText '...'
  @controller.view.addSubview @label

  Facebook.app_id = NSBundle.mainBundle.objectForInfoDictionaryKey('APP_ID')
  Facebook. do |granted, error|
    if granted
      @label.setText Facebook.accounts[0].username
    else
      puts error.code
      puts error.localizedDescription
      puts error.localizedRecoveryOptions
      puts error.localizedRecoverySuggestion
      @label.setText 'Fail... See Log'
    end
  end

  true
end