我正在尝试,为了实施新的GCM,我正在关注Google的说法:http: //developer.android.com/guide/google/gcm/gs.html
我在获取设备注册ID时遇到困难!
我的应用不断尝试与Google服务器连接,这里我的错误日志:
onReceive: com.google.android.gcm.intent.RETRY
GCM IntentService class: com.dombox.app.GCMIntentService
Acquiring wakelock
[GCMIntentService] start
Registering app com.dombox.app of senders _my_sender_id_
Releasing wakelock
onReceive: com.google.android.c2dm.intent.REGISTRATION
GCM IntentService class: com.dombox.app.GCMIntentService
Acquiring wakelock
[GCMIntentService] start
handleRegistration: registrationId = null, error = SERVICE_NOT_AVAILABLE, unregistered = null
Registration error: SERVICE_NOT_AVAILABLE
Scheduling registration retry, backoff = 912617 (768000)
Releasing wakelock
Run Code Online (Sandbox Code Playgroud)
这是我的活动代码,要求提供ID:
try{
Log.i(TAG, "[checkNotifRegistration] checkDevice");
GCMRegistrar.checkDevice(this);
Log.i(TAG, "[checkNotifRegistration] checkManifest");
GCMRegistrar.checkManifest(this);
if (GCMRegistrar.isRegistered(this)) {
Log.i(TAG, "[checkNotifRegistration] reg id : "+GCMRegistrar.getRegistrationId(this));
}
final String …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种方法来设置Android上的maximun和minimun时间TimePickerDialog,并将默认的分钟间隔从1分钟更改为5分钟,
我觉得这很简单,但我找不到方法!
我正在使用iOS 6的新方式来分享信息:UIActivityViewController.要根据媒体(Facebook,Twitter或邮件)选择共享数据,我的视图控制器实现UIActivityItemSource协议如下:
- (IBAction)onShareButton:(UIButton *)sender
{
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[self] applicationActivities:nil];
activityViewController.excludedActivityTypes = @[UIActivityTypeMessage, UIActivityTypeAssignToContact, UIActivityTypeCopyToPasteboard, UIActivityTypeMessage, UIActivityTypePostToWeibo, UIActivityTypePrint, UIActivityTypeSaveToCameraRoll];
[self presentViewController:activityViewController animated:YES completion:^{}];
}
#pragma mark - UIActivityItemSource Protocol
- (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType {
if ([activityType isEqualToString:UIActivityTypePostToFacebook]) {
NSArray *items = @[@"message facebook", [NSURL URLWithString:@"http://www.myUrlFacebook.com"]];
return items;
} else if ([activityType isEqualToString:UIActivityTypePostToTwitter]) {
NSArray *items = @[@"message twitter", [NSURL URLWithString:@"http://www.myUrlTwitter.com"]];
return items;
} else if ([activityType isEqualToString:UIActivityTypeMail]) {
NSArray *items = @[@"message …Run Code Online (Sandbox Code Playgroud) 我试图以编程方式将ViewController推送到导航控制器,而我正在使用我的故事板来创建它.
这是我的代码:
+ (void) pushViewController:(NSString *) identifier ForItems:(NSMutableArray *) items sender:(UIViewController *) sender {
GenericViewController *viewController = (GenericViewController *)[sender.storyboard instantiateViewControllerWithIdentifier:identifier];
viewController.items = [[NSMutableArray alloc] init];
[viewController.items removeAllObjects];
[viewController.items addObject:[[NSMutableArray alloc] init]];
[viewController.items[0] addObjectsFromArray:items];
[sender.navigationController pushViewController:viewController animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
在GenericViewController viewDidLoad我用我的items.多亏了一些断点,我已经看到了等于零GenericViewController viewDidLoad之后的juste .instantiateViewControllerWithIdentifieritems
我以为MyViewController viewDidLoad在pushViewController方法中调用了.
知道为什么viewDidLoad在这期间被召唤instantiateViewControllerWithIdentifier?
---更新:---
在这里我的 viewDidLoad
- (void)viewDidLoad
{
for (MyItem *currentItem in self.items[0]) {
[Do Something]
}
[super viewDidLoad];
[...]
}
Run Code Online (Sandbox Code Playgroud)
self.items …
在iTune connect上传我的应用程序时,我收到以下警告:
The app references non-public selectors in My_application.app/My_application: productName
Run Code Online (Sandbox Code Playgroud)
我从这些问题中得到了一些知识:
如何在Apple App Loader中调试"应用程序引用非公共选择器"错误?
Apple称该应用程序引用了我的应用程序中的非公共选择器.那是什么意思?
但没有具体的内容productName.搜索我的项目时,我只在Google Analytics库中找到了此字符串.我仔细检查我是否有最新版本的Google Analytics.
我假设Apple验证器机器人认为我正在尝试以编程方式更改App名称(我没有这样做).
是否有任何应用已被此警告拒绝?如何删除此警告?
我想在 UITableViewCell 内创建一个圆形 UIView (myView)
在 iOS 10 之前,我曾经func awakeFromNib()这样做过:
class MyCell: UITableViewCell {
@IBOutlet var myView: UIView!
override func awakeFromNib() {
super.awakeFromNib()
print(myView.bounds.height)
myView.layer.cornerRadius = myView.bounds.height/2
myView.layer.masksToBounds = true
}
}
Run Code Online (Sandbox Code Playgroud)
myViewheight 和 with通过故事板中的自动布局约束设置为30 。
但在控制台中print(myView.bounds.height)显示1000.0 。所以圆角半径指令将半径设置为500并myView完全消失。
UITableViewCelliOS 10 的生命周期有变化吗?iOS 10 中设置 view.bounds 的函数是否发生变化?cornerRadius如何在 iOS 10 中将视图高度设置为一半?
为了得到接近我想要的结果,我需要在我的UITableViewController:
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
tableView.reloadData()
}
Run Code Online (Sandbox Code Playgroud)
但我很确定这不是最佳的......
AudioKit 包括一个很好的工具来跟踪信号幅度: AKAmplitudeTracker
这个跟踪器可以用一个 thresholdCallback 初始化,我想回调应该在达到阈值时触发。
我正在使用MicrophoneAnalysis 示例,但找不到触发回调的方法。
这是我的代码:
var mic: AKMicrophone!
var trackerAmplitude: AKAmplitudeTracker!
var silence: AKBooster!
AKSettings.audioInputEnabled = true
mic = AKMicrophone()
trackerAmplitude = AKAmplitudeTracker(mic, halfPowerPoint: 10, threshold: 0.01, thresholdCallback: { (success) in
print("thresholdCallback: \(success)")
})
trackerAmplitude.start()
silence = AKBooster(trackerAmplitude, gain: 0)
AudioKit.output = silence
Run Code Online (Sandbox Code Playgroud)
我尝试使用halfPowerPoint和threshold值,但即使值很低,我也找不到打印任何东西的方法:/
而当我打印时trackerAmplitude.amplitude,我的值高于0.01
有什么我想念的吗?
我有以下NSArray:
NSArray myArray = @[@{@300:@"5 min"},
@{@900:@"15 min"},
@{@1800:@"30 min"},
@{@3600:@"1 hour"}];
Run Code Online (Sandbox Code Playgroud)
我想要我的词典的价值列表:
@[@"5 min",@"15 min",@"30 min",@"1 hour"]
Run Code Online (Sandbox Code Playgroud)
我的词典的关键列表:
@[@300, @900, @1800, @3600]
Run Code Online (Sandbox Code Playgroud)
最好的方法是什么?我在考虑谓词,但我不知道如何使用它?
我正在尝试做一个非常简单的应用程序,目的是监听音频流(AAC 64 kbps).为此,我使用AVPlayer了Apple AVFoundation以下内容:
ViewController.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize playerItem, player;
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (void) viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
playerItem = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"http://stream.myjungly.fr/MYJUNGLY2"]];
[playerItem addObserver:self forKeyPath:@"timedMetadata" options:NSKeyValueObservingOptionNew context:nil];
player = [AVPlayer playerWithPlayerItem:playerItem];
[player play];
NSLog(@"player item error : %@", playerItem.error.description);
NSLog(@"player error : %@", player.error.description);
}
- (void) observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object
change:(NSDictionary*)change context:(void*)context {
if ([keyPath isEqualToString:@"timedMetadata"])
{
AVPlayerItem* _playerItem = object;
for (AVMetadataItem* metadata in …Run Code Online (Sandbox Code Playgroud) 我想在Y轴上只绘制10个Majors Ticks.为此,我正在使用方法preferredNumberOfMajorTicks = 10.
但正如屏幕截图所示,它并没有真正起作用......

这是我对y轴的配置:
CPTXYAxis *y = axisSet.yAxis;
y.labelingPolicy = CPTAxisLabelingPolicyFixedInterval;
//y.majorIntervalLength = CPTDecimalFromDouble(2);
y.preferredNumberOfMajorTicks = 10;
y.minorTicksPerInterval = 5;
y.tickDirection = CPTSignNone;
y.majorTickLineStyle = majorLineStyle;
y.minorTickLineStyle = minorLineStyle;
y.axisLineStyle = majorLineStyle;
y.majorTickLength = 7.0;
y.minorTickLength = 5.0;
y.labelTextStyle = whiteTextStyle;
y.minorTickLabelTextStyle = minorTickBlackTextStyle;
y.titleTextStyle = whiteTextStyle;
y.axisConstraints = [CPTConstraints constraintWithLowerOffset:40.0];
Run Code Online (Sandbox Code Playgroud)
有些东西应该超过正确的方法,preferredNumberOfMajorTicks = 10但我看不出是什么......
我想要给出一个给定数字的星期名称,这里是伪代码:
getDayStringForInt:0 = sunday
getDayStringForInt:1 = monday
getDayStringForInt:2 = tuesday
getDayStringForInt:3 = wenesday
getDayStringForInt:4 = thursday
getDayStringForInt:5 = friday
getDayStringForInt:6 = saturday
Run Code Online (Sandbox Code Playgroud)
我尝试过以下代码,但有些东西不起作用......
- (void) setPeriodicityDayOfWeek:(NSNumber *)dayOfWeek{
gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
dateFormatter = [[NSDateFormatter alloc] init];
NSLocale *frLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
[dateFormatter setLocale:frLocale];
[gregorian setLocale:frLocale];
NSDate *today = [NSDate date];
NSDateComponents *nowComponents = [gregorian components:NSYearCalendarUnit | NSWeekCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit fromDate:today];
[nowComponents setWeekday:dayOfWeek];
NSDate *alertDate = [gregorian dateFromComponents:nowComponents];
[dateFormatter setDateFormat:@"EEEE"];
NSLog(@"Day Of Week : %@ …Run Code Online (Sandbox Code Playgroud) objective-c ×5
ios ×3
android ×2
audiokit ×1
avfoundation ×1
avplayer ×1
core-plot ×1
ios10 ×1
ios6 ×1
nsarray ×1
nsdate ×1
nsdictionary ×1
nspredicate ×1
storyboard ×1
swift ×1
swift2 ×1
timepicker ×1
uitableview ×1
viewdidload ×1