我一直在按照实施此SDK的说明进行操作:https://github.com/BranchMetrics/Branch-iOS-Invite-SDK ...以下是我在Podfile中的内容:
platform :ios, '8.0'
use_frameworks!
target 'My-App' do
pod 'BranchInvite'
end
这是我得到的错误......
我已经做了很多故障排除试图找出问题,看了这种类型的这种报告的过去问题,并且由于某种原因我无法得到" BranchWelcomeViewController" (也不是BranchInvite)被识别/导入。知道我在这里做错了什么吗?我是否需要填充我的桥接头?
PS:我使用Xcode 7,Swift 2,OS X 10.10.5和最新版本的Cocoapods。
由于
答案 0 :(得分:1)
@SamYoungNY,在使用您发送的项目进行调试后,使用Swift的最佳方法如下:
<强> Podfile 强>
public class SQLiteHandler extends SQLiteOpenHelper {
private static final String TAG = SQLiteHandler.class.getSimpleName();
// All Static variables
// Database Version
private static final int DATABASE_VERSION = 1;
// Database Name
private static final String DATABASE_NAME = "users";
// Login table name
private static final String TABLE_LOGIN = "login";
// Login Table Columns names
private static final String KEY_ID = "id";
private static final String KEY_PROFILE = "profile";
private static final String KEY_EMAIL = "email";
private static final String KEY_NAME = "name";
private static final String KEY_BIRTHDAY = "birthday";
private static final String KEY_AGE = "age";
private static final String KEY_UID = "uid";
private static final String KEY_CREATED_AT = "created_at";
public SQLiteHandler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// Creating Tables
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_LOGIN_TABLE = "CREATE TABLE " + TABLE_LOGIN + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_PROFILE + " BLOB"
+ KEY_EMAIL + " TEXT UNIQUE," + KEY_NAME + " TEXT," + KEY_BIRTHDAY + " TEXT," + KEY_AGE + " INT," + KEY_UID + " TEXT,"
+ KEY_CREATED_AT + " TEXT" + ")";
db.execSQL(CREATE_LOGIN_TABLE);
Log.d(TAG, "Database tables created");
}
// Upgrading database
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// Drop older table if existed
db.execSQL("DROP TABLE IF EXISTS " + TABLE_LOGIN);
// Create tables again
onCreate(db);
}
/**
* Storing user details in database
* */
public void addUser(final User user) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_PROFILE, user.getProfile());
values.put(KEY_EMAIL, user.getEmail());
values.put(KEY_NAME, user.getName());
values.put(KEY_BIRTHDAY, user.getBirthday());
values.put(KEY_UID, user.getUid());
values.put(KEY_CREATED_AT, user.getCreatedAt());
long id = db.insert(TABLE_LOGIN, null, values);
db.close();
Log.d(TAG, "New user is added into sqlite: " + id);
}
/**
* Getting user data from database
* */
public HashMap<String, String> getUserDetails() {
HashMap<String, String> user = new HashMap<String, String>();
String selectQuery = "SELECT * FROM " + TABLE_LOGIN;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// Move to first row
cursor.moveToFirst();
if (cursor.getCount() > 0) {
user.put("profile", cursor.getString(1));
user.put("email", cursor.getString(2));
user.put("name", cursor.getString(3));
user.put("birthday", cursor.getString(4));
user.put("uid", cursor.getString(5));
user.put("created_at", cursor.getString(6));
}
cursor.close();
db.close();
// return user
Log.d(TAG, "Fetching user from Sqlite: " + user.toString());
return user;
}
/**
* Getting user login status return true if rows are there in table
* */
public int getRowCount() {
String countQuery = "SELECT * FROM " + TABLE_LOGIN;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(countQuery, null);
int rowCount = cursor.getCount();
db.close();
cursor.close();
// return row count
return rowCount;
}
/**
* Re crate database Delete all tables and create them again
* */
public void deleteUsers() {
SQLiteDatabase db = this.getWritableDatabase();
// Delete All Rows
db.delete(TABLE_LOGIN, null, null);
db.close();
Log.d(TAG, "Deleted all user info from sqlite");
}
}
您应用的桥接标题
pod "Branch"
pod "BranchInvite"
如果您之前没有,请务必使用您项目的#import <Branch/Branch.h>
#import <BranchInvite/BranchInvite.h>
#import <BranchInvite/BranchInviteViewController.h>
#import <BranchInvite/BranchInviteTextContactProvider.h>
#import <BranchInvite/BranchInviteEmailContactProvider.h>
#import <BranchInvite/BranchWelcomeView.h>
#import <BranchInvite/BranchWelcomeViewController.h>
#import <BranchInvite/BranchWelcomeControllerDelegate.h>
#import <BranchInvite/BranchWelcomeDefaultView.h>
文件。如果这不起作用,请告诉我们。我很高兴继续使用您发送的实际项目进行调试。
答案 1 :(得分:1)
我在@ st.derrick上收到了很多关于这个问题的帮助,并且我的版本控制有些不可思议但最后我得到了它在branch.io文档中找到的东西,答案是这个链接:
https://support.branch.io/support/discussions/topics/6000008855
答案 2 :(得分:0)
我还不能发表评论,但这里是SamYoungNY链接到该帖子的存档文本。
如果你遇到一个问题,你知道你已经导入&gt;分支,但Xcode似乎无法找到它,我们可能知道答案。您可能正在查看类似下面的截图:
(图片未存档)
这可能意味着您将分支导入为“文件夹参考”&gt;而不是“组”。
从项目中删除Branch文件夹
确保分支不再位于项目的文件夹中(在文件&gt;系统中,而不是Xcode中)
- 醇>
重新导入分支并确保选择“创建群组”(请参阅下面的屏幕截图&gt;)