我正在尝试使用远程通知处理所有可能的情况.应用程序在前台时我很好 - 调用didReceiveRemoteNotification.问题是当应用程序处于后台状态时,我收到推送通知.什么都没有.当应用程序回到前台时,如何让用户知道他有新的远程通知?
我要称之为Twitter API的方法
https://api.twitter.com/1.1/lists/statuses.json?list_id=12345
Run Code Online (Sandbox Code Playgroud)
用户在列表中检索推文.但我的客户只提供列表的名称,我不知道如何使用列表名称获取列表ID.清单是这样的:https://twitter.com/DatasportNews/lists/i-campioni-di-brasile2014.
我尝试过这种方法
https://api.twitter.com/1.1/lists.json?screen_name=i-campioni-di-brasile2014
Run Code Online (Sandbox Code Playgroud)
获取id列表但始终返回此消息
{"errors":[{"message":"Your credentials do not allow access to this resource","code":220}]}.
Run Code Online (Sandbox Code Playgroud)
我用api密钥和api秘密登录并获得令牌,但这种方法不起作用.
想法?
我有一个UITableView自定义UITableViewCell,我indentationLevel用来移动内容到右边.在iOS 7中一切正常,但在iOS 8中,当我设置indentationLevel > 0表格视图时,不会渲染单元格和界面冻结.唯一的解决方案是退出应用程序.如果我继续调试,我可以看到应用程序使用的内存不断增加,CPU处于99%.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CustomCellReuseID";
TreeTableViewCell *cell = (TreeTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.delegate = self;
FolderSection *aFolderSection = self.dataSourceArray[indexPath.section];
FolderNode *aFolderNode = (FolderNode *)aFolderSection.folderNodes[indexPath.row];
cell.indentationWidth = 20.0f;
cell.indentationLevel = aFolderNode.level;
// set up the cell
return cell;
}
Run Code Online (Sandbox Code Playgroud)
想法?
我有一个模态视图控制器,我用UIModalPresentationPageSheet显示.问题是他的默认大小对我的内容来说太大了:所以我想调整大小是根据我的内容进行调整.
有没有人知道这样做的方法/技巧?
谢谢
frame ipad modalviewcontroller uimodalpresentationstyle cgrect
我在视频模式下有一个UIImagePickerController; 在我完成录制视频后,点击"使用"按钮接受我使用此方法-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info的视频,我想在视频中保存视频并从视频中检索第一帧以在UIImageView中显示它.我使用的代码如下:
NSString *tempFilePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
NSURL *url = [NSURL fileURLWithPath:tempFilePath];
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
moviePlayer.shouldAutoplay = NO;
imageView.image = [moviePlayer thumbnailImageAtTime:0.0 timeOption:MPMovieTimeOptionNearestKeyFrame];
问题是,如果我添加方法UISaveVideoAtPathToSavedPhotosAlbum,应用程序崩溃.
UISaveVideoAtPathToSavedPhotosAlbum(tempFilePath, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);
其中tmpFilePath的是,我以上使用的相同.
相反,如果我只使用其中一个操作(UISaveVideoAtPathToSavedPhotosAlbum或检索框架)都可以正常工作!
控制台报告此错误:
因未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'+ [NSInvocation invocationWithMethodSignature:]:方法签名参数不能为nil'
有任何想法吗 ?谢谢...
我的问题非常简单.我有一个JPopupMenu显示两个JMenuItem.我发现知道用哪个项目点击的唯一方法
class MenuActionListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
System.out.println("Selected: " + e.getActionCommand());
}
}
Run Code Online (Sandbox Code Playgroud)
但该命令e.getActionCommand()打印项目内的文本.我想得到一个索引from 0 to n,知道哪个项被点击,而不是文本(可以修改).可能吗 ?
我有以下代码
NSString * myStr = [[NSString alloc] initWithFormat:@""];
Run Code Online (Sandbox Code Playgroud)
但在Xcode中,我有一个带有"预期表达式"的红色感叹号.
我解决了以下问题:
[NSString stringWithFormat:@"Number is not from 1 to 6. randomNumber is %d", randomNumber]
Run Code Online (Sandbox Code Playgroud)
但我想知道问题是什么.
图片
http://imgur.com/iICMhYc&S7QwhFT#1
谢谢
我有UITableViewCell一个.xib关联的子类.我不知道为什么但是在init之后,表视图仍然是空的,没有单元格.如果我旋转iPad,神奇地出现了单元格.
在viewDidLoad我已经注册表视图.xib
- (void)viewDidLoad
{
self.tableView.allowsMultipleSelectionDuringEditing = YES;
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.alpha = 0.0f;
[self.tableView registerNib:[UINib nibWithNibName:@"VirtualFileTableViewCell" bundle:[NSBundle mainBundle]]
forCellReuseIdentifier:VirtualFileTableViewCellReuseID];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
self.tableView.contentInset = UIEdgeInsetsMake([self.topLayoutGuide length], 0.0f, [self.bottomLaoyout guide length], 0.0f);
self.tableView.scrollIndicatorInsets = UIEdgeInsetsMake([self.topLayoutGuide length], 0.0f, [self.bottomLaoyout guide length], 0.0f);
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO];
[UIView animateWithDuration:0.5f animations:^{
self.tableView.alpha = ( self.viewType == ViewTypeList ? 1.0f : 0.0f );
} completion:^(BOOL finished) {}];
}
- …Run Code Online (Sandbox Code Playgroud) 我用它AVQueuePlayer来播放声音(一个供孩子们听图画书的小应用程序),但如果 iPhone 静音,则听不到音频。
即使 iPhone 静音,有办法强制播放音频吗?我认为 YouTube 可以听到音频,Instagram 则需要调大音量才能听故事。
谢谢。
我的iOS项目中的sqlite存在问题.我的配置:
当我在设备上安装我的应用程序时,我在控制台"没有这样的表测试"中收到此错误消息.但桌子肯定存在.
奇怪的是:如果我在另一台Mac上使用以下配置创建相同的项目(相同),那么该应用程序可以完美运行:
此外,如果我在第二个配置(Snow Leopard - Xcode 4.2)上安装第一个配置(Lion - Xcode 4.3.2)创建的项目,该应用程序仍然无法正常工作.
相反,如果我在Mac上安装第二个配置(Snow Leopard - Xcode 4.2)创建的项目第一个配置(Lion - Xcode 4.3.2),该应用程序可以工作.
这个问题让我抓狂!有人有想法吗?
我NSData在 eg 中有一个十六进制值<EC>。
现在我需要将此值转换为int变量以获取int x = -20.
想法?
我有这个代码无休止的旋转 UIImageView
[UIView animateWithDuration:0.3f
delay:0.0f
options:UIViewAnimationOptionCurveLinear|UIViewAnimationOptionRepeat
animations: ^{
self.spinner.transform = CGAffineTransformRotate(CGAffineTransformIdentity, -M_PI);
}
completion: ^(BOOL finished) {
}];
Run Code Online (Sandbox Code Playgroud)
但第一个我把这个方法称为图像,它顺时针旋转而不是逆时针旋转.如果我在图像旋转时重新调用此方法,它会改变方向并开始逆时针旋转.
想法?
CMMotionActivity当框架返回automotive类型时,我正在使用并试图区分汽车,火车和公共汽车。
这不仅可以使用来实现CoreMotion,所以我认为有必要使用第三方服务,例如云服务或第三方框架。
有谁遇到过同样的问题吗?谢谢