- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试实现 Parse Facebook 登录功能,但我收到了一个“applicationDidBecomeActive”的无效重新声明
。我不确定从哪里查明此错误的来源。
这是在我的 AppDelegate.swift
中触发错误的行:
**func applicationDidBecomeActive(application: UIApplication) {**
FBAppCall.handleDidBecomeActiveWithSession(PFFacebookUtils.session())
}
完整文件代码如下:
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
Parse.setApplicationId("xxxxxx", clientKey:"xxxxxxx")
PFFacebookUtils.initializeFacebook()
return true
}
func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
func application(application: UIApplication,
openURL url: NSURL,
sourceApplication: String?,
annotation: AnyObject?) -> Bool {
return FBAppCall.handleOpenURL(url, sourceApplication:sourceApplication,
withSession:PFFacebookUtils.session())
}
func applicationDidBecomeActive(application: UIApplication) {
FBAppCall.handleDidBecomeActiveWithSession(PFFacebookUtils.session())
}
}
这是我的桥接头文件:
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import <FacebookSDK/FacebookSDK.h>
#import <Parse/Parse.h>
#import <ParseFacebookUtils/PFFacebookUtils.h>
#import <Bolts/Bolts.h>
我似乎无法查明确切的错误,因为代码直接来自 Parse.com 文档。
最佳答案
如错误所述,您正在重新声明 applicationDidBecomeActive
- 它在您的源代码中列出了两次。
从文件中删除以下行
func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
关于ios - Swift - 解析 Facebook "Invalid redeclaration of ' applicationDidBecomeActive'”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28823379/
function test($str) { $c = count($str); if ($c>1) { foreach ($str as $key => $value) $result
function test($str) { $c = count($str); if ($c>1) { foreach ($str as $key => $value) $result
诚然,我的 OOPHP 有点不稳定,但我看不出这有什么问题。在我的一个 Controller 中,我包含了一个 utils 表,它与 Controller 一样,扩展了基本的 CI_Controlle
是否可以声明一个成员是基类成员的子类? 例如 class A { int a; } class B : A { int b; } class Foo { A *baz; } cl
#include int x=13; // forcing space allocation int x; int main(){ printf("%d\n",x); } 上面的代码可以编译,但下
VIM Syntastic 插件适用于 .go 文件。但有时我想在同一个文件夹中有几个 go 文件,每个文件都有 main() 方法,这样我就可以 go run xxx 每个文件(用于演示)。这将在我
我今天将 wordpress 更新为 Newest 时遇到了这个 fatal error 。我使用 Barely Corporate 主题。 第 126 行是代码的最后一行。有没有人知道这是什么?该主
我有以下代码,但是当我运行我的工厂时出现以下异常: Cannot redeclare questionIndex() (previously declared in /Users/user/Deskt
我正在使用 PHP,并且有一个常量声明表列详细信息。 我目前 $sql = "CREATE TABLE ' . $table_name . ' ' . TABLE_COLUMNS; 并 odbc 执行
我是 C++ 的新手,遇到了这段代码: 文件.h namespace Type { typedef BOOL (WINAPI *TYCopyFile) ( PCHAR lpExis
我正在尝试创建自己的“智能迭代器”,并且我想使用 SFINAE 来根据迭代器的标签来设置一些运算符: 这是我的代码: template class RangeFilterIterator { publ
我正在尝试创建一个程序,该程序接收整数值并使用 atoi 将它们转换为 2 的补码整数,并确定进行了哪种类型的转弯。这是我的代码: #include #include int turn(int t
在文件范围内,我可以使用初始化(静态)变量的前向声明。存在循环依赖。 s[0]指的是count的地址。 count 是指 s 中的项目数。 struct s { int *a; }; static i
这个问题在这里已经有了答案: "Fatal error: Cannot redeclare " (18 个答案) 关闭 4 年前。 (使用 MySQL 编写 PHP) Fatal error: Ca
Clang 接受这段代码,但 GCC 拒绝它: class Foo { public: static constexpr double kVal = 0.25f; }; const double
#include #include double integrateF(double low, double high) { double low = 0; double high
我有以下表格: user, logbook, user_logbook 用户日志是一个联结表(schema.xml 中的isCrossRef="true"),包含user_id 和logbook_id
我正在开发一个基于 TinyBoard (xampp) 的简单图像板,当我尝试发布图像时,网站出于某种原因给我错误: Fatal error: Cannot redeclare imagecreate
我刚刚完成我的应用程序并且它运行良好,但是在按文件 -> 复制后突然,我收到一条消息说 Invalid redeclaration of 'ViewController' 如果可以的话,请帮帮我好吗?
这个问题在这里已经有了答案: "Fatal error: Cannot redeclare " (18 个答案) 关闭 3 年前。 我有这个 php 脚本: function hoeveelzijn
我是一名优秀的程序员,十分优秀!