我试图在iOS 6教程:第1/2部分中运行Apple推送通知服务中的Ray Wenderlich教程.
我在本地目录中创建了AppID和SSL证书以及密钥和PEM文件.之后,我到了测试证书是否有效的步骤,我从这个本地目录调用了以下命令:
$ openssl s_client -connect gateway.sandbox.push.apple.com:2195
-cert PushChatCert.pem -key PushChatKey.pem
Run Code Online (Sandbox Code Playgroud)
这产生了很多输出.在输出的中间是以下内容:
verify error:num=20:unable to get local issuer certificate
verify return:0
Run Code Online (Sandbox Code Playgroud)
这是一个错误,还是一个错误的测试?如果是错误,原因是什么或者您建议解决什么?
这是完整的输出(减去证书数据):
Enter pass phrase for PushChatKey.pem:
CONNECTED(00000003)
depth=1 /C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c) 2009 Entrust, Inc./CN=Entrust Certification Authority - L1C
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
0 s:/C=US/ST=California/L=Cupertino/O=Apple Inc./OU=iTMS Engineering/CN=gateway.sandbox.push.apple.com
i:/C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c) 2009 Entrust, Inc./CN=Entrust Certification Authority - L1C
1 s:/C=US/O=Entrust, …
Run Code Online (Sandbox Code Playgroud) 我今天升级到xcode 5.0.然后我按下播放在iOS模拟器中运行我的项目.这最初奏效了.然后我决定要运行探查器.当我这样做时,我收到了消息:
Xcode cannot run using the selected device.
Choose a destination with a supported architecture in order to run on this device.
Run Code Online (Sandbox Code Playgroud)
我看了几个关于这个问题的帖子,并决定做一个Clean and Build.现在我再也无法在探查器或模拟器中运行了.我一直得到这样的信息:
Xcode cannot run using the selected device.
Choose a destination with a supported architecture in order to run on this device.
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
以下是各种设置:
我的部署目标是6.1
我也尝试将部署目标更改为7.0,但这也不起作用
我试图合并分支,它导致错误" 无法打开项目...无法打开因为项目文件无法解析 ".然后我尝试接受其他stackoverflow响应的建议(即编辑文件以删除损坏),但无法编辑该文件.看起来这实际上是一个目录,所以也许这个结构改变了xcode的4.4版本,因为无法打开项目的响应...因为无法解析项目文件所以无法打开.
然后我尝试从我的时间机器备份恢复myProject.xcodeproj.这不起作用,因为它说我没有访问myProject.xcodeproj的权限.我试图更改该目录的权限,但这没有帮助.
我关闭并重新打开xcode.现在的错误是:
项目... xcodeproj无法打开,因为它缺少project.pbxproj文件.
如何在xcode 4.4版中修复此问题?是否可以从xcode中的先前快照或存档或版本进行恢复.可以用时间机器恢复.我想避免重建整个项目.
我创建了一个分支并进行了一系列更改.我提交了更改,然后存档了更改.然后我切换到主分支并尝试进行合并.它说我有未提交的更改.所以我在master分支上做了一个提交,看看它在说什么.它说有一个名为UserInterfaceState.xcuserstate的文件已被修改.所以我做出了改变(不确定改变是什么).然后我试着再次合并.然后它打开一个合并窗口,表明与UserInterfaceState.xcuserstate存在冲突.所以我回到分支机构,发现现在需要提交相同的文件.这没有出现过.所以我承诺了,然后又回到了主分公司.我再次尝试合并但由于未提交的更改而无法合并.果然,UserInterfaceState.xcuserstate再次需要提交.我承诺并尝试合并.冲突也有同样的问题.这是一个恶性循环.
该文件是什么以及如何解决报告的冲突.它不会显示在我的项目导航窗口中.此外,它不在unix文件系统中.我完全陷入困境.建议?我正在使用xcode 4.5.2
我有一个旨在运行Landscape的应用程序.这是一个Cocos2D应用程序.它工作正常,直到我添加另一个窗口(如显示广告)或我显示模态视图控制器.
当我这样做时,即使我有明确的设置,窗口/视图仍然会旋转 shouldAutoRotate = NO
此外,Apple表示如果shouldAutorotate返回NO ,则不会调用supportedInterfaceOrientations.但是,在调用shouldAutorotate之前和之后都会调用它.为什么会发生这种情况?在iOS 8中管理自动轮换的解决方案是什么?
虽然我已经看到许多SO问题解决了以前的iOS版本中的自动旋转问题(在iOS 6中没有调用 shouldAutorotateToInterfaceOrientation中的如何设置管理自动旋转的最详尽描述),似乎没有解决被调用的supportedInterfaceOrientations的问题即使shouldAutoRotate = NO; 并且视图仍在旋转,即使它被告知不要旋转.
为了完全解释我的解释,这里是我如何设置它的描述:
首先,为了显示启动图像,我被迫在info.plist中设置设备方向以支持所有方向.否则,启动时屏幕为黑色.
接下来,我的代码是如何实现的:
- (void) applicationDidFinishLaunching:(UIApplication*)application
{
...
// Init the 2nd window
secondWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // secondWindow is defined as a UIWindow
// Init the second View Controller
nrViewController = [[NonRotatingViewController alloc] initWithNibName:nil bundle:nil]; // nrViewController is defined as a UIViewController
nrViewController.wantsFullScreenLayout = YES; // this insures that if the status bar it transparent, the view …
Run Code Online (Sandbox Code Playgroud) 我将Spotify播放器添加到我的应用程序中,该应用程序也使用MPMusicPlayerController播放音乐.当Spotify播放音乐并且屏幕被锁定时,当用户按下锁定屏幕上的这些按钮时,不会收到播放/暂停和FFW/RWD的遥控事件.
如果从MPMusicPlayerController播放音乐,我可以根据以下代码接收远程控制事件:
-(void) ViewDidLoad {
...
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
...
}
Run Code Online (Sandbox Code Playgroud)
和
- (BOOL) canBecomeFirstResponder
{
return YES;
}
- (void) remoteControlReceivedWithEvent: (UIEvent*) event
{
// see [event subtype] for details
if (event.type == UIEventTypeRemoteControl) {
// We may be receiving an event from the lockscreen
switch (event.subtype) {
case UIEventSubtypeRemoteControlTogglePlayPause:
case UIEventSubtypeRemoteControlPlay:
case UIEventSubtypeRemoteControlPause:
// User pressed play or pause from lockscreen
[self playOrPauseMusic:nil];
break;
case UIEventSubtypeRemoteControlNextTrack:
// User pressed FFW from lockscreen
[self fastForwardMusic:nil];
break;
case …
Run Code Online (Sandbox Code Playgroud) background-process spotify lockscreen mpmusicplayercontroller ios
我试图从视图层次结构中删除iAd视图.我的实现成功从视图中删除了iAd横幅,但我仍然收到以下错误:
Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:)
Run Code Online (Sandbox Code Playgroud)
根据Apple文档,如果用户导航离开显示iAd的屏幕并且您不希望他们暂时返回该屏幕,则删除iAd视图是合理的:
If the user navigates from a screen of content with a banner view to a screen that does
not have a banner view, and you expect them to be on that screen for a long period of
time, remove the banner view from the view hierarchy, set its delegate to nil and
release it before transitioning to the new screen of content. More generally, avoid
keeping a banner …
Run Code Online (Sandbox Code Playgroud) 我在xcode控制台中遇到以下错误,但我不知道它抱怨的只读数据库是什么:
CPSqliteStatementPerform: attempt to write a readonly database for UPDATE ddd.ext_container SET orig_date_modified = (SELECT date_modified FROM container WHERE pid=container_pid) WHERE orig_date_modified=0
CPSqliteStatementReset: attempt to write a readonly database for UPDATE ddd.ext_container SET orig_date_modified = (SELECT date_modified FROM container WHERE pid=container_pid) WHERE orig_date_modified=0
Run Code Online (Sandbox Code Playgroud)
以下代码在错误之前执行:
MPMediaQuery *myPlaylistsQuery = [MPMediaQuery playlistsQuery];
NSArray *array = [myPlaylistsQuery collections];
playlists = [[NSMutableArray alloc] init];
[playlists addObject:@"new playlist"];
NSLog(@"%@", [playlists objectAtIndex:0]);
int numPlaylists = 1;
for (MPMediaPlaylist *arrayItem in array) {
NSLog(@"Got here");
Run Code Online (Sandbox Code Playgroud)
NSLog打印"新播放列表"
然后在初始化for循环后立即打印CPSqliteStatementPerform:和CPSqliteStatementReset:errors.
然后NSLog打印'Got …
我试图在我的iPhone应用程序中使用iTunes Affiliate Search API来搜索iTunes Store中的内容.搜索"我想牵着你的手"的示例网址是:
http://itunes.apple.com/search?term=i+want+to+hold+your+hand&entity=song
Run Code Online (Sandbox Code Playgroud)
此搜索会找到标题为"我想牵着你的手"的所有歌曲.但是,我只想找到披头士乐队的歌曲.我尝试了以下内容来缩小搜索范围,但它不起作用:
http://itunes.apple.com/search?term=i+want+to+hold+your+hand&entity=song&term=beatles&entity=musicartist
Run Code Online (Sandbox Code Playgroud)
这只是提供了相同的结果.
如何使用itunes.apple.com/search构建一个URL以查找特定艺术家的歌曲标题
我需要在一对PHP脚本中进行对称加密和解密.我正在使用mcrypt_encrypt和crypt_decrypt.为了测试这个,我有以下代码:
$encrypted_token = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $ENCRYPTION_SECRET, $refresh_token, MCRYPT_MODE_ECB);
$encrypted_encoded_token=base64_encode($encrypted_token);
echo "\nEncrypted Token: " . $encrypted_encoded_token . "\n";
Run Code Online (Sandbox Code Playgroud)
为了测试这一点,在同一个PHP脚本中,我执行以下操作:
$decoded_refresh_token = base64_decode($encrypted_encoded_token);
$decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $ENCRYPTION_SECRET, $decoded_refresh_token, MCRYPT_MODE_ECB);
echo "\nDecrypted Token After decrypt: " . $decrypted . "\n";
Run Code Online (Sandbox Code Playgroud)
我的输入$ refresh_token是一长串字符,看起来像这样(只有更长):
AQCNKTZhaWTmUl3WvHOtlkv2Vc-Ybkl24D5Zp1lZPLBraTxrr-YQhErXrI2IWWEIWk5lnBc1k
Run Code Online (Sandbox Code Playgroud)
解密后的令牌解密后看起来像这样:
AQCNKTZhaWTmUl3WvHOtlkv2Vc-Ybkl24D5Zp1lZPLBraTxrr-YQhErXrI2IWWEIWk5lnBc1k???????????????????
Run Code Online (Sandbox Code Playgroud)
我的$ ENCRYPTION_SECRET长度为32个字符.base64_encode和decode是因为我是json_encoding并解码Post中的令牌.
我究竟做错了什么?
ios ×5
xcode ×3
affiliates ×1
autorotate ×1
build ×1
commit ×1
encryption ×1
iad ×1
instruments ×1
ios8 ×1
itunes ×1
lockscreen ×1
mcrypt ×1
objective-c ×1
openssl ×1
php ×1
project ×1
spotify ×1
sqlite ×1
ssl ×1
url ×1