小编Jac*_*ack的帖子

这个应用程序的开发人员没有为Facebook登录正确设置此应用程序?

我正试图在我的脚本中使用Facebook登录.我已经做了一切,但当我尝试使用Facebook帐户登录时,我从Facebook收到此错误:

错误

应用程序未设置:此应用程序的开发人员尚未为Facebook登录正确设置此应用程序.

这是错误截图:

在此输入图像描述

有任何想法吗?

facebook facebook-graph-api

513
推荐指数
14
解决办法
26万
查看次数

编译器无法键入 - 检查此表达式swift 4?

更新xCode后,我在我的代码中收到此错误:

编译器无法在合理的时间内对此表达式进行类型检查; 尝试将表达式分解为不同的子表达式

代码 :

//check popup in window frame

let spaceFromLeftSide = cutOutViewX.constant + cutOutViewWidth.constant/2 - (options.textWidth + padding*2)/2

if spaceFromLeftSide < 0{

    if options.side == .bottom {
        messageRightSpaceFromBottomDot.constant -= spaceFromLeftSide - padding
    }
    else if options.side == .top{
        messageRightSpaceFromTopDot.constant += spaceFromLeftSide - padding
    }
}

let spaceFromRightSide = cutOutViewX.constant + cutOutViewWidth.constant/2 + (options.textWidth + padding*2)/2

if spaceFromRightSide > targetView.frame.size.width{

    if options.side == .bottom {
        messageRightSpaceFromBottomDot.constant -= spaceFromRightSide - ( targetView.frame.size.width )
    }
    else if options.side == .top{
        messageRightSpaceFromTopDot.constant …
Run Code Online (Sandbox Code Playgroud)

ios swift

43
推荐指数
6
解决办法
2万
查看次数

从不在集合中的核心数据中获取对象

我正在尝试从不在给定集合中的核心数据中获取对象,但我无法使其工作.

例如,假设我们有一个名为User的核心数据实体,它具有一些属性,如userName,familyName,givenName和active.给定一组表示一组用户名的字符串,我们可以轻松获取与该用户名列表对应的所有用户:

NSManagedObjectContext *moc = [[NSManagedObjectContext alloc] init];
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"User"
                                          inManagedObjectContext:moc];
[request setEntity:entity];

NSArray *userNames = [NSArray arrayWithObjects:@"user1", @"user2", @"user3", nil];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"userName IN %@", userNames];
[request setPredicate:predicate];
NSArray *users = [moc executeFetchRequest:request error:nil];
Run Code Online (Sandbox Code Playgroud)

但是,我想获取该集的补充,即,我希望核心数据中的所有用户都没有在userNames数组中指定的用户名.有谁知道如何处理这个问题?我认为"NOT"在谓词中添加一个很简单(i.e., "userName NOT IN %@"),但是Xcode会抛出一个异常,说无法解析谓词格式.我还尝试使用可用于获取请求的谓词构建器而没有运气.文档也没有特别的帮助.建议?评论?感谢你的帮助 :)

iphone core-data objective-c nspredicate

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

端口扬声器的未知选定数据源(类型:扬声器)?

我多次在cat日志中收到此消息:

[avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port Speaker (type: Speaker)
Run Code Online (Sandbox Code Playgroud)

我正在使用此代码播放背景音乐:

  let path = Bundle.main.path(forResource: fileName, ofType:"mp3")!
        let url = URL(fileURLWithPath: path)

        do {
                let sound = try AVAudioPlayer(contentsOf: url)
                self.player = sound
                sound.prepareToPlay()
                sound.volume = 0.05
                sound.numberOfLoops = loops
                sound.play()
        } catch {
            print("[PLAY SOUND][DELEGATE] error loading file -> \(fileName)")
        }
Run Code Online (Sandbox Code Playgroud)

我做了一个研究,我发现了类似的问题,所以我在viewdidload中添加了音频类别:

  do {
            try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, mode: AVAudioSessionModeDefault)
            try AVAudioSession.sharedInstance().setActive(true)
        } catch {
            print(error)
        }
Run Code Online (Sandbox Code Playgroud)

在我添加了上面的代码之后,即使手机处于静音模式,背景音乐也在播放!并且调试器消息Unknown selected data source for Port Speaker (type: Speaker)仍然显示

audio xcode swift

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

返回Yahoo! 使用YQL以Celsius为天气API数据

我想要雅虎!天气API,温度为摄氏度.

&u=c在请求中添加了,但它仍然在华氏温度下返回数据.

这是我正在使用的URL:

http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20location=%22LEXX0003%22&format=json&u=c

并回应:

{"query":{"count":1,"created":"2014-01-13T13:06:43Z","lang":"en-US","results":{"channel":{"item":{"title":"Conditions for Beirut, LE at 1:59 pm EET","lat":"33.82","long":"35.48","link":"http://us.rd.yahoo.com/dailynews/rss/weather/Beirut__LE/*http://weather.yahoo.com/forecast/LEXX0003_f.html","pubDate":"Mon, 13 Jan 2014 1:59 pm EET","condition":{"code":"30","date":"Mon, 13 Jan 2014 1:59 pm EET","temp":"64","text":"Partly Cloudy"},"description":"\n<img src=\"http://l.yimg.com/a/i/us/we/52/30.gif\"/><br />\n<b>Current Conditions:</b><br />\nPartly Cloudy, 64 F<BR />\n<BR /><b>Forecast:</b><BR />\nMon - Partly Cloudy. High: 64 Low: 55<br />\nTue - Cloudy. High: 66 Low: 56<br />\nWed - Mostly Sunny. High: 68 Low: 58<br />\nThu - Sunny. High: 70 Low: 60<br />\nFri - Scattered Showers. High: 65 Low: 57<br />\n<br />\n<a href=\"http://us.rd.yahoo.com/dailynews/rss/weather/Beirut__LE/*http://weather.yahoo.com/forecast/LEXX0003_f.html\">Full Forecast at …
Run Code Online (Sandbox Code Playgroud)

yahoo json yql

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

mysql错误!服务器退出而不更新PID文件?

我的Vps mysql不会启动,当我尝试命令服务mysql启动时我得到了这个错误

root@## [/var/lib/mysql]# service mysql start
Starting MySQL... ERROR! The server quit without updating PID file (/var/lib/mysql/***.***.com.pid).
Run Code Online (Sandbox Code Playgroud)

这是 my.cnf

[mysqld]
local-infile=0
set-variable = 100
max_connections=100
safe-show-database

#userstat_running=on
query_cache_limit=4M
query_cache_size=64M
query_cache_type=1
max_user_connections=100
interactive_timeout=30
wait_timeout=100
connect_timeout = 20
thread_cache_size = 256
key_buffer_size=16M
join_buffer_size=2M
max_heap_table_size=16M
low_priority_updates=1
max_allowed_packet=128M
max_seeks_for_key=100
record_buffer=2M
sort_buffer_size=16M
read_buffer_size=16M
max_connect_errors=10
# Try number of CPU's*2 for thread_concurrency
thread_concurrency=4
myisam_sort_buffer_size=64M
tmp_table_size= 64M
set-variable=table_cache=100
read_rnd_buffer_size=1M
skip-name-resolve

open_files_limit=6050
[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid
Run Code Online (Sandbox Code Playgroud)

这是错误日志

140227 21:23:41 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140227 …
Run Code Online (Sandbox Code Playgroud)

mysql

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

Spotify SDK缺少令牌刷新服务?

我试图避免每次会话在Spotify for SDK中过期时用户的弹出窗口授予权限.

Pop出现一小时后,弹出窗口似乎再次授予用户权限,这样他就可以在我的应用程序上播放Spotify中的曲目,我在尝试续订会话时遇到错误:

[PLAYER][PLAY][SPOTIFY] Error renew Session Optional(Error Domain=com.spotify.auth Code=0 "Missing token refresh service." UserInfo={NSLocalizedDescription=Missing token refresh service.})
[PLAYER][SPOTIFY] Session could not be renewed,popup login
Run Code Online (Sandbox Code Playgroud)

在这里我如何尝试更新会话:

//Renew Session
func renewSession(completion:@escaping (Bool)->())
{
    print("[PLAYER][PLAY][SPOTIFY] Renew Session requested ")

    let auth = SPTAuth.defaultInstance()
        auth?.renewSession(auth?.session, callback: { (error, session) in

            if (error != nil)
            {
                print("[PLAYER][PLAY][SPOTIFY] Error renew Session \(String(describing: error))")
                completion(false)
                return
            }

            auth?.session = session

            if auth?.session.isValid() == true
            {
                print("[PLAYER][PLAY][SPOTIFY] Renew Session Success")
                completion(true)
            }else
            {
                print("[PLAYER][PLAY][SPOTIFY] Renew Session …
Run Code Online (Sandbox Code Playgroud)

session spotify ios swift3

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

sql PDO fetchall重复对象键?

我在PDO使用fetchAll()方法问题.

当执行显示对象数组的结果时,它很好,但每个对象都有重复的键,例如:

$catid = intval( $api->param['catid'] );

      $json   = array();
      $prepar = "SELECT * FROM " . DB_PREFIX . "cat_sub WHERE `catid` = :catid ORDER BY `orderid` asc";

      try{

               $q = $api->pdo->prepare($prepar);

               $q->bindparam(":catid" , $catid , PDO::PARAM_INT);

               $q->execute();

               $json = $q->fetchAll();

      }catch( PDOException $e ){

           $api->showError = $e->getMessage();

      }

      echo json_encode($json);
      exit();
Run Code Online (Sandbox Code Playgroud)

每个对象的输出是

{
"subcatid":"6",
"0":"6",
"title":"coool ",
"1":"coool ",
"catid":"2",
"2":"2",
"orderid":"1",
"3":"1"
},
Run Code Online (Sandbox Code Playgroud)

它应该是

{
"subcatid":"6",
"title":"coool ",
"catid":"2",
"orderid":"1",
},
Run Code Online (Sandbox Code Playgroud)

任何建议如何没有循环或foreach :)

php sql pdo

7
推荐指数
2
解决办法
2445
查看次数

MPMusicPlayer错误域= MPErrorDomain代码= 4?

我有音乐播放器的问题,大多数歌曲都给出了错误

错误域= MPErrorDomain代码= 4

测试设备有Apple音乐订阅,并且曲目在他们在Apple音乐应用程序中正常工作的应用程序上出错!

这是代码:

let applicationMusicPlayer = MPMusicPlayerController.systemMusicPlayer()
 applicationMusicPlayer.setQueueWithStoreIDs([ID])

      if #available(iOS 10.1, *)
      {

        applicationMusicPlayer.prepareToPlay { (error) in

            if (error != nil)
            {
                print("[MUSIC PLAYER] Error preparing : \(String(describing: error))")
                return
            }else
            {
                self.start_timer();
                self.applicationMusicPlayer.play()
            }

        }

      }else
      //Play directly ios below version 10.1
      {
        self.applicationMusicPlayer.play()
      }

    }
Run Code Online (Sandbox Code Playgroud)

但是我试过,当轨道出现这个错误时,我去了Apple音乐播放器并从那里播放它的工作,然后我回到我的应用程序并从我的应用程序播放它工作也很好,所以我需要去Apple音乐应用程序播放不在我的应用程序中播放的曲目,使它们在我的应用程序中工作!这有点奇怪为什么?

PS:测试设备有Apple音乐订阅

audio-player mpmusicplayercontroller ios swift

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

跟踪和修复 swiftUI 崩溃(看到 PreferenceKeys,预期的 ViewList)?

当我在我的应用程序中快速移动时发生崩溃(打开一个子页面然后返回登陆)。

来自 TestFlight 的应用程序崩溃日志:

来自 TestFlight 的应用程序崩溃日志

Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x00000001c87ff334 __pthread_kill + 8
1   libsystem_pthread.dylib         0x00000001e6221aa0 pthread_kill + 272 (pthread.c:1392)
2   libsystem_c.dylib               0x00000001a3b86c10 __abort + 116 (abort.c:147)
3   libsystem_c.dylib               0x00000001a3b86b9c abort + 116 (abort.c:118)
4   AttributeGraph                  0x00000001c3c31a6c AG::precondition_failure(char const*, ...) + 192 (ag-util.cc:51)
5   AttributeGraph                  0x00000001c3c1f4cc AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 828 (ag-graph.cc:0)
6   AttributeGraph                  0x00000001c3c3109c AGGraphGetValue + 232 (ag-graph-impl.h:43)
7   SwiftUI                         0x00000001a140bbc4 AnyViewList.Item.list.getter + 72 (<compiler-generated>:0)
8   SwiftUI                         0x00000001a140b5e8 AnyViewList.updateValue() + 512 …
Run Code Online (Sandbox Code Playgroud)

xcode swiftui

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