我正在尝试使用新的SDK(3.0)从facebook获取我的朋友列表.我遇到了与我需要在Bundle中插入什么类型的params以及如何使用newMyFriendRequest和GraphAPI相关的问题.
我没有在facebook文档中找到关于我们必须使用哪种字段的地方.基于GraphExplorer,我在我的Bundle中插入了带有"id,name,friend"字符串的键"fields"作为值.下面的代码显示了我现在正在做的事情.在我得到我的照片和名字后,我执行newMyFriendRequest.我相信它默认使用GraphAPI.
我在StackOverflow上看过一些相关帖子:
Facebook Android SDK请求参数:在哪里查找文档?
它对我帮助很小,我不想使用FQL.对于响应II我收到这个JSON就像一个答案:
{Response: responseCode: 500, graphObject: null, error: {HttpStatus: 500, errorCode: 100, errorType: FacebookApiException, errorMessage: Unsupported operation}, isFromCache:false}
Run Code Online (Sandbox Code Playgroud)
请注意,我是Facebook SDK for Android的新手.
private void onSessionStateChange(final Session session, SessionState sessionState, Exception ex){
if(session != null && session.isOpened()){
getUserData(session);
}
}
private void getUserData(final Session session){
Request request = Request.newMeRequest(session,
new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
if(user != null && session == Session.getActiveSession()){
pictureView.setProfileId(user.getId());
userName.setText(user.getName());
getFriends();
}
if(response.getError() …Run Code Online (Sandbox Code Playgroud) [ 编辑 ]修正了我的代码.是while(temp!= NULL),而不是while(temp-> next!= NULL).很抱歉插入错误的代码.
今天我参加了在线编程测试.采访者使用Codility评估我的代码和其他受访者.在某个时刻,关于链接列表的问题已经提出.它将计算链表有多少项.我做了唯一可行的方法,AFAIK:
//This is struct declaration
struct SomeStruct
{
int value;
SomeStruct* next;
}
int elementCount(SomeStruct* list)
{
int count = 0;
if(list != NULL)
{
SomeStruct* temp = list;
while(temp != NULL)
{
count++;
temp = temp->next;
}
}
return count;
}
Run Code Online (Sandbox Code Playgroud)
我记得当我发送这段代码作为这个问题的答案时,Codility指出这个解决方案是错误的,因为它耗费了太多时间来执行任务.在我的头脑和SO上的这个帖子中没有其他方法可以获得链表的大小而不会遍历它,而不是以一种简单的方式.
当Codility说这个解决方案错了时会有问题吗?还是有另一种方法?
PS:允许使用STL的测试
我有与反应有关的javascript问题.这是页面渲染时chrome捕获的错误:
Uncaught TypeError: Super expression must either be null or a function, not undefined
at _inherits (application.js:16301)
at application.js:16310
at Object.232.prop-types (application.js:16549)
at s (application.js:1)
at application.js:1
at Object.233../Collapse (application.js:16574)
at s (application.js:1)
at application.js:1
at Object.1.react (application.js:78)
at s (application.js:1)
Run Code Online (Sandbox Code Playgroud)
当我使用npm安装我的反应时,它会抱怨react和react-height的对等依赖关系:
??? UNMET PEER DEPENDENCY react@0.14.9
? ??? envify@3.4.1
? ? ??? jstransform@11.0.3
? ? ??? base62@1.1.2
? ? ??? commoner@0.10.8
? ? ? ??? commander@2.9.0
...
Run Code Online (Sandbox Code Playgroud)
和:
??? UNMET PEER DEPENDENCY react-height@2.2.1
? ??? create-react-class@15.5.2
? ??? fbjs@0.8.12 …Run Code Online (Sandbox Code Playgroud) 我正在为我的应用程序实现自定义标头。在 AppBarLayout 中,我使用 Toolbar 和自定义布局(名为 CustomHeader)。我的 CustomHeader 有左下角和右下角圆角。为了正确显示我设置了android:background="@null".
具有自定义标题的 appBarLayout 布局:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/logoAppbarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"
android:elevation="@dimen/_4sdp">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/imgToolbarLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_toolbar_logo" />
</android.support.v7.widget.Toolbar>
<CustomHeader
android:id="@+id/stepOneHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00FFFFFF"
app:selected_step="1"/>
<ProgressBar
android:id="@+id/stepProgressBar"
style="@style/AppTheme.StepProgressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progress="0"
android:visibility="gone" />
</android.support.design.widget.AppBarLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的 CustomHeader 的布局。为了简洁起见,我省略了一些部分:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/header_bg">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_marginStart="@dimen/_18sdp"
android:layout_marginEnd="@dimen/_18sdp"
android:layout_marginTop="@dimen/_12sdp"
android:layout_marginBottom="@dimen/_12sdp">
<View
android:id="@+id/headerDivider"
android:layout_width="match_parent"
android:layout_height="@dimen/_2sdp"
android:background="@drawable/bg_divider_border"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" …Run Code Online (Sandbox Code Playgroud) 我已经在我的 flutter 项目中插入了 firebase,最近它给了我一个输出错误。应用程序运行良好:
Plugin project :firebase_core_web not found. Please update settings.gradle.
Run Code Online (Sandbox Code Playgroud)
跑扑医生说没发现问题。
buuild.gradle 文件:
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.sample.flutter_with_firebase"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
Run Code Online (Sandbox Code Playgroud)
我的 pubspec.yaml:
...
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
firebase_core: ^0.4.5
firebase_auth: ^0.14.0+5
cloud_firestore: ^0.12.9+4
provider: ^3.1.0
...
Run Code Online (Sandbox Code Playgroud)
搜索这个错误我发现了这些链接:
在头文件中,我有一个结构:
#ifndef _MY_STRUCT_
#define _MY_STRUCT_
struct myStruct{
char c1[1];
char c2[10];
char c3[10];
}
typedef myStruct MYSTRUCT;
#endif
Run Code Online (Sandbox Code Playgroud)
在另一个头文件中这个结构:
#include "my_struct.h"
struct another_struct{
int val1;
MYSTRUCT strct;
};
Run Code Online (Sandbox Code Playgroud)
当我编译此代码时,我收到以下消息:
The text "strct" is unexpected. MYSTRUCT may be undeclared or ambiguous.
Run Code Online (Sandbox Code Playgroud)
对我来说,两个结构都很好.我无法理解为什么编译器会抱怨这个.
感谢帮助.