小编Rub*_*con的帖子

从Social.framework获取Facebook访问令牌(iOS6)

我需要检索我的系统帐户的Facebook访问令牌,我在设置应用程序中设置.

我知道Social.framework(iOS6)知道我所有的FB帐户信息,我可以使用SLRequest类对Graph API执行API调用,就像这篇文章http://blogs.captechconsulting.com/blog/eric-stroh/ios- 6教程整合Facebook的-你的应用程序

但是,我的问题是 - 如何检索我的Facebook系统帐户的访问令牌?

我找到了Twitter的解决方案https://dev.twitter.com/docs/ios/using-reverse-auth,但是你可以帮我解决Facebook问题吗?

facebook facebook-graph-api ios ios6

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

播放AVCaptureAudioDataOutputSampleBufferDelegate中的音频

我正在使用AVCaptureAudioDataOutputSampleBufferDelegate捕获音频

  _captureSession = [[AVCaptureSession alloc] init];
  [self.captureSession setSessionPreset:AVCaptureSessionPresetLow];


  // Setup Audio input
  AVCaptureDevice *audioDevice = [AVCaptureDevice
                                defaultDeviceWithMediaType:AVMediaTypeAudio];
  AVCaptureDeviceInput *captureAudioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioDevice error:&error];
  if(error){
      NSLog(@"Error Start capture Audio=%@", error);
  }else{
      if ([self.captureSession canAddInput:captureAudioInput]){
          [self.captureSession addInput:captureAudioInput];
      }
  }


  // Setup Audio output
  AVCaptureAudioDataOutput *audioCaptureOutput = [[AVCaptureAudioDataOutput alloc] init];
  if ([self.captureSession canAddOutput:audioCaptureOutput]){
      [self.captureSession addOutput:audioCaptureOutput];
  }
  [audioCaptureOutput release];


  //We create a serial queue 
  dispatch_queue_t audioQueue= dispatch_queue_create("audioQueue", NULL);
  [audioCaptureOutput setSampleBufferDelegate:self queue:audioQueue];
  dispatch_release(audioQueue);


  /*We start the capture*/
  [self.captureSession startRunning];
Run Code Online (Sandbox Code Playgroud)

代表:

  - (void)captureOutput:(AVCaptureOutput *)captureOutput  didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c avfoundation ios

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

从p12/pem文件获取软件包ID

是否可以从AP12的p12/pem文件获取应用程序的包ID?

我有一个系统,用户可以上传他的推送证书(p12或pem),很高兴向他展示有关捆绑ID的信息,以便用户可以检查他上传的内容

pkcs#12 pem apple-push-notifications ios

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

将Swift Dictionary转换为NSDictionary

我创建了一个Swift Dictionary对象

var params = ["first_name": firstNameTextField.text,
              "last_name": lastNameTextField.text,
              "company": companyTextField.text,
              "email_address": emailTextField.text,
              "phone_number": phoneTextField.text]
Run Code Online (Sandbox Code Playgroud)

接下来,我有ObjC框架,我连接到我的Swift应用程序.里面有一个属性对象

@property (nonatomic, retain) NSMutableDictionary *fields;
Run Code Online (Sandbox Code Playgroud)

我正试图以这种方式分配它

object.fields = params
Run Code Online (Sandbox Code Playgroud)

并得到一个错误:

Cannot convert the expression's type '()' to type 'NSMutableDictionary!'
Run Code Online (Sandbox Code Playgroud)

我也试过这样做

var params = ["first_name": firstNameTextField.text,
              "last_name": lastNameTextField.text,
              "company": companyTextField.text,
              "email_address": emailTextField.text,
              "phone_number": pnoneTextField.text].mutableCopy() as NSMutableDictionary

object.fields = params
Run Code Online (Sandbox Code Playgroud)

编译得很好,但我遇到了运行时错误:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: 
attempt to insert nil object from objects[0]'
Run Code Online (Sandbox Code Playgroud)

我打印了所有字段,但它们不是零:

println(firstNameTextField.text)
println(lastNameTextField.text)
println(companyTextField.text)
println(emailTextField.text)
println(pnoneTextField.text) …
Run Code Online (Sandbox Code Playgroud)

swift

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

Jest:测试具有 ESM 依赖项的组件

我有以下组件:

应用程序.js

import React from "react";
import { Slider } from "./Slider";

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <Slider />
      </header>
    </div>
  );
}

export { App };
Run Code Online (Sandbox Code Playgroud)

滑块.jsx

import {Virtual, Navigation} from 'swiper';
import {Swiper, SwiperSlide} from 'swiper/react';


export const Slider = ({meetings = []}) => {
  const rerenderSwiperKey = useMemo(() => Date.now(), [meetings.length]);
  const lessThanThree = meetings.length < 3;
  const lessThanTwo = meetings.length < 2;
  return (
    <Swiper
      key={rerenderSwiperKey}
      navigation={{
        nextEl: '.swiper-button.next',
        prevEl: '.swiper-button.prev',
      }} …
Run Code Online (Sandbox Code Playgroud)

javascript testing unit-testing reactjs jestjs

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

findAndModify失败并显示错误:"无法同时更新'field1'和'field1'

我正在尝试构建MongoDB Java findAndModify查询.

主要目的是我想在自己的插入查询中设置_id.

这是我的代码:

BasicDBObject findFilter = new BasicDBObject("type", "group")
//
BasicDBObject dialogInsertObject = new BasicDBObject("name", "my group").append("_id", new ObjectId());
//
BasicDBObject dialogUpdateObject = new BasicDBObject("name", "my group");
//
BasicDBObject upsertMap = new BasicDBObject();
upsertMap.append("$setOnInsert", dialogInsertObject);
upsertMap.append("$set", dialogUpdateObject);


DBObject dialogObject = dialogCollection.findAndModify(findFilter, 
   new BasicDBObject("_id", "1"), null, false, upsertMap, true, true);
Run Code Online (Sandbox Code Playgroud)

我收到一个错误:

com.mongodb.CommandFailureException: { "serverUsed" : "localhost:27017" , 
  "errmsg" : "exception: Cannot update 'name' and 'name' at the same time" , 
  "code" : 16836 , "ok" : 0.0} …
Run Code Online (Sandbox Code Playgroud)

java mongodb mongodb-java mongodb-query

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

为什么系统调用UIApplicationDelegate的dealloc方法?

我有下一个代码:

// create new delegate
MyCustomApplicationDelegate *redelegate = [[MyCustomApplicationDelegate alloc] init];
redelegate.delegate = [(NSObject<UIApplicationDelegate42> *)[UIApplication sharedApplication].delegate retain];

// replace delegate
[UIApplication sharedApplication].delegate = redelegate;

...
[UIApplication sharedApplication].delegate = redelegate.delegate;
[redelegate.delegate release];
Run Code Online (Sandbox Code Playgroud)

在最后一行之后,系统调用了基础UIApplicationDelegate类的dealloc方法.所以为什么?我阅读了有关UIApplication的Apple文档,关于委托属性:

@property(nonatomic,assign)id委托

讨论委​​托必须采用UIApplicationDelegate正式协议.UIApplication分配并不保留代表.

它清楚地表明UIApplication分配并且不保留代表.那么,为什么它会破坏我的基础代表呢?

ios

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

Appledoc - 按类别分组类

我正在使用Appledoc生成评论.在基本的变体我得到这样的页面http://sdk.quickblox.com/ios/

我希望得到类似这样的内容http://qblx.co/OrAHzE - 按类别分组的类.

我读了这篇文档http://gentlebytes.com/appledoc-docs-comments/,没有找到任何关于此的信息.有人做过这样的事吗?坦克

appledoc

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

Java XML:如何转义'&',但跳过'&amp;'

我需要逃避'&',但跳过 &amp;

我用下一个功能

public static String translateAll(String input, String[] patterns, String[] replacements) {
    String result = input;

    for (int i = 0; i < patterns.length; i++) {
        result = result.replaceAll(patterns[i], replacements[i]);
    }

    return result;
}
Run Code Online (Sandbox Code Playgroud)

...

private static final String[] decoded = { "&", "<", ">", "\"", "\'" };
private static final String[] encoded = { "&amp;", "&lt;", "&gt;", "&quot;", "&apos;" };

public static String escape(String input) {
    return translateAll(input, decoded, encoded);
}
Run Code Online (Sandbox Code Playgroud)

...

String escapedBodyValue = XMLUtils.escape(originBodyValue);
Run Code Online (Sandbox Code Playgroud)

它取代了所有与使用&amp; …

java xml

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