小编Sri*_*har的帖子

iOS:XMPPFramework:无法使用gmail帐户登录

我正在使用robbiehanson的XMPPFramework开发一个简单的聊天应用程序.我在我的系统中安装了eJabberd服务器并创建了一些用户.我设置hostname ="localhost"并尝试使用该用户凭据登录.它已成功登录.当我更改主机名即hostname ="talk.google.com"时.我无法登录.我收到了"登录尝试被阻止"的邮件和

<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized></not-authorized></failure>

仅供参考,

- (BOOL)connectWithUsername:(NSString*)username WithPassword:(NSString*)pwd
{
    if (![xmppStream isDisconnected]) {
        return YES;
    }

   // NSString *myJID = [[NSUserDefaults standardUserDefaults] stringForKey:kXMPPmyJID];
    //NSString *myPassword = [[NSUserDefaults standardUserDefaults] stringForKey:kXMPPmyPassword];
    NSString* myJID=username;
    NSString* myPassword=pwd;
    //
    // If you don't want to use the Settings view to set the JID,
    // uncomment the section below to hard code a JID and password.
    //
    // Replace me with the proper JID and …
Run Code Online (Sandbox Code Playgroud)

objective-c ios xmppframework

6
推荐指数
1
解决办法
285
查看次数

Android:ProgressDialog未在适配器类中显示

在我的应用程序中,我有一个listview,每个项目都有一个按钮.如果用户单击该按钮,我想执行一些http连接.所以我在Adapter类中使用AsyncTask.现在问题是进度对话框没有显示.

private class MyClass extends AsyncTask<Void, Long, Boolean> {
        private Context context;
        private ServerCall call = new ServerCall();
        private ProgressDialog progressDialog1;

        public MyClass(Context context) {
            this.context = context;
        }

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            try {
                progressDialog1 = ProgressDialog.show(context, "",
                        "Please wait...", true);
                progressDialog1.setIndeterminate(true);

            } catch (final Throwable th) {

            }

        }

        @Override
        protected void onProgressUpdate(Long... values) {

            super.onProgressUpdate(values);
        }

        @Override
        protected Boolean doInBackground(Void... params) {
            //some tasks

            return true;
        }

        @Override
        protected void onPostExecute(Boolean result) {
            if (mode.equalsIgnoreCase("History")) …
Run Code Online (Sandbox Code Playgroud)

android android-context android-adapter android-asynctask

5
推荐指数
1
解决办法
2751
查看次数

如何对ViewPager中的所有页面使用单个Fragment?

在我的申请中,我必须在 中显示学生详细信息ViewPager。我使用了一个片段(例如StudentPageFragment),并编写了小部件初始化代码,onCreateView()如下所示:

public static Fragment newInstance(Context context) {
    StudentPageFragment f = new StudentPageFragment();
    return f;
}

public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.stud_list_page,
            null);
    // initialize all widgets here
    displayStudentDetails();
    return root;
}

protected void displayStudentDetails() {
    ArrayList<Student>studList = User.getStudentsList();
    if (studList != null) {
        int loc = (pageIndex * 3);
        for (int i = 0; i < 3; i++) {
            if (loc < studList.size()) {
                // …
Run Code Online (Sandbox Code Playgroud)

android android-fragments android-viewpager android-pageradapter

5
推荐指数
1
解决办法
4127
查看次数

iOS:AVSpeechSynthesizer:需要在Headphone左声道中说出文字

我正在使用AVTpeechSynthesizer for TextToSpeech.我必须在HeadPhone左侧的Channel(Mono 2)中演奏.我有以下设置输出通道.

func initalizeSpeechForRightChannel(){     
    let avSession = AVAudioSession.sharedInstance()
    let route = avSession.currentRoute
    let outputPorts = route.outputs
    var channels:[AVAudioSessionChannelDescription] = []
    //NSMutableArray *channels = [NSMutableArray array];
    var leftAudioChannel:AVAudioSessionChannelDescription? = nil
    var leftAudioPortDesc:AVAudioSessionPortDescription? = nil 
    for  outputPort in outputPorts {
        for channel in outputPort.channels! {
            leftAudioPortDesc = outputPort
            //print("Name: \(channel.channelName)")
            if channel.channelName == "Headphones Left" {
                channels.append(channel)
                leftAudioChannel = channel
            }else {
               // leftAudioPortDesc?.channels?.removeObject(channel)
            }
        }
    }

    if channels.count > 0 {
        if #available(iOS 10.0, *) {
            print("Setting Left Channel") …
Run Code Online (Sandbox Code Playgroud)

text-to-speech avfoundation ios swift

5
推荐指数
1
解决办法
516
查看次数

iOS 14:允许位置访问 | 总是找不到菜单

我尝试使用 iOS 14 模拟器在 Xcode 12 beta 2 中运行我的项目。我发现在“允许位置访问设置”屏幕中找不到“始终”菜单。

在此处输入图片说明

我已经给出了以下 info.plist

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>TEST APP</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>TEST APP</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>TEST APP</string>
Run Code Online (Sandbox Code Playgroud)

xcode ios swift ios14

5
推荐指数
2
解决办法
4958
查看次数

如何在Swift中将CMSampleBuffer转换为数据?

我需要转换CMSampleBufferData格式.我正在使用一个第三方框架进行音频相关任务.该框架为我提供了对象中的流式传输(即实时音频)音频CMSampleBuffer.

像这样:

func didAudioStreaming(audioSample: CMSampleBuffer!) {
    //Here I need to conver this to Data format. 
    //Because I am using GRPC framework for Audio Recognization, 
}
Run Code Online (Sandbox Code Playgroud)

请提供我的步骤来转换CMSampleBufferData.

FYI

    let formatDesc:CMFormatDescription? = CMSampleBufferGetFormatDescription(audioSample)

    <CMAudioFormatDescription 0x17010d890 [0x1b453ebb8]> {
    mediaType:'soun' 
    mediaSubType:'lpcm' 
    mediaSpecific: {
        ASBD: {
            mSampleRate: 16000.000000 
            mFormatID: 'lpcm' 
            mFormatFlags: 0xc 
            mBytesPerPacket: 2 
            mFramesPerPacket: 1 
            mBytesPerFrame: 2 
            mChannelsPerFrame: 1 
            mBitsPerChannel: 16     } 
        cookie: {(null)} 
        ACL: {(null)}
        FormatList Array: {(null)} 
    } 
    extensions: {(null)}
}
Run Code Online (Sandbox Code Playgroud)

core-media ios cmsamplebuffer swift

4
推荐指数
1
解决办法
3453
查看次数

Android 2.0:支持Actionbar库(没有资源的appcompat v7支持库):找不到资源@ style/Theme.AppCompat.Light.DarkActionBar

我按照http://developer.android.com/guide/topics/ui/actionbar.html链接在Android 2.0中实现ActionBar

我遵循了以下程序.

i)创建一个新项目

ii)在我的项目中创建一个libs文件夹

iii)包括android-support-v13.jar和android-support-v7-appcompat.jar文件并在构建路径中添加它们

我的Manifiest xml文件是

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.tgactionbar"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" />

    <application

        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        >
        <activity
            android:name="com.example.tgactionbar.MainActivity"
            android:label="@string/app_name" 
            android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
Run Code Online (Sandbox Code Playgroud)

我收到了这个错误

错误:错误:找不到与给定名称匹配的资源(在'theme'处,值为'@ style/Theme.AppCompat.Light.DarkActionBar').

android actionbarsherlock android-support-library

3
推荐指数
1
解决办法
1万
查看次数

MySQL:使用If else更新查询

我想更新表,我不知道哪个列将更新.这是一个简单的例子

Update tablename
set 
if col1='A' then col1='IA',col2='XXX'
if col3='A' then col3='IA', col4='XXX'
where
(col1='A' and col2='UNKNOWN') or (col3='A' and col4='UNKNOWN')
Run Code Online (Sandbox Code Playgroud)

这里无论是col1col3肯定包含'A'

请提供正确的查询

mysql sql

2
推荐指数
1
解决办法
4644
查看次数

Swift:多个目标处理:宏不起作用

来自参考如何使用swift语言处理XCode中的多个目标?https://www.appcoda.com/using-xcode-targets/

我创建了三个目标,每个目标都有不同的捆绑ID和应用程序图标.我还在"其他swift标志" - >自定义swift标志部分添加了不同的标志

喜欢

对于第一个目标,我添加了"-DGOLD",对于第二个目标,我添加了"-DSILVER",对于第三个目标,我添加了"-DPLATINUM".

在AppDelegate中我写了一个代码

#if GOLD
print ("Gold")
#elseif SILVER
print ("Silver")
#else
print ("Platinum")
#endif
Run Code Online (Sandbox Code Playgroud)

仅供参考, I am using Xcode 8.3

我试图运行第一个目标,我总是得到"白金".请告诉我如何正确地获得旗帜

macros xcode targets ios

2
推荐指数
1
解决办法
1604
查看次数

Android:单击EditView时隐藏软键盘

在我的应用程序中,我必须从用户那里获取日期.
首先我使用一个按钮,当用户单击按钮时,将出现一个对话框,其中包含datepicker并在一个TextView中获得结果.
现在我想用EditView替换按钮.在单击EditView时,必须出现对话框,不应出现键盘.

@Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.report);
        EmployeeGlobal eg=(EmployeeGlobal)getApplicationContext();
        String uid=eg.getMainUserId();
        ArrayList<String>list=eg.getAllProjects(uid);
          Spinner spinner = (Spinner)findViewById(R.id.all_projs);
          ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list);
          spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          spinner.setAdapter(spinnerArrayAdapter);
          Toast.makeText(getApplicationContext(), "Report"+uid, Toast.LENGTH_LONG).show();
          mStartDateDisplay=(TextView)findViewById(R.id.strdate);
          mEndDateDisplay = (TextView) findViewById(R.id.enddate);
            mEndDate = (Button) findViewById(R.id.end_dateb);
            mStartDate=(Button)findViewById(R.id.start_dateb);
            mYear=c1.get(Calendar.YEAR);
            mMonth = c1.get(Calendar.MONTH);
            mDay = c1.get(Calendar.DAY_OF_MONTH);
            mStartDate.setOnClickListener(new View.OnClickListener() {

                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    showDialog(DATE_DIALOG_START);

                    //updateDisplay(mStartDateDisplay);
                }
            });
            mEndDate.setOnClickListener(new View.OnClickListener() {

                public void onClick(View v) {
                    // …
Run Code Online (Sandbox Code Playgroud)

java xml android

1
推荐指数
1
解决办法
1758
查看次数