我的应用程序支持4种语言和推送通知.当我向APNS发送推送通知时,我正在发送loc_key&loc-args.现在我需要在loc-args数组中发送本地化字符串,以便在应用程序收到推送通知时我可以在iOS应用程序端翻译它们.
但是当我发送本地化字符串时loc-args,它不是在通知中心显示已翻译的字符串,而是显示本地化的密钥.
我的字符串文件包含以下2条消息:
"WINNER_ALERT"= "Congratulations! %@ won the match & became %@ player";
"ROLE_PROFESSIONAL_LOCALIZED_KEY" = "professional"
Run Code Online (Sandbox Code Playgroud)
服务器发送有效负载
{
aps = {
alert = {
"loc-args" = (
"John",
"ROLE_PROFESSIONAL_LOCALIZED_KEY"
);
"loc-key" = "WINNER_ALERT";
};
badge = 1;
sound = default;
};
}
Run Code Online (Sandbox Code Playgroud)
当我发送上述有效负载然后在iOS通知中心,消息看起来像
Congratulations! John won the match & became ROLE_PROFESSIONAL_LOCALIZED_KEY player
Run Code Online (Sandbox Code Playgroud)
代替
Congratulations! JOHN won the match & became professional player
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我是否可以发送本地化的字符串loc-args?如果是的话,我的有效载荷有什么问题?
提前致谢
apple-push-notifications localizable.strings nslocalizedstring ios7
在我的应用程序中,我在表视图中显示带有索引列表的联系人.我正在显示索引列表如下:
static NSString *letters = @"abcdefghijklmnopqrstuvwxyz#";
-(void)getAllUserInfoUsingBlock:(lclResultsArray) block
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
NSMutableArray *allUserInfoArray = [[NSMutableArray alloc]init];
NSLog(@"[letters length]:- %d",[letters length]);
for (int i = 0; i < [letters length]; i++ ) {
NSMutableDictionary *row = [[NSMutableDictionary alloc] init];
char currentLetter[2] = { toupper([letters characterAtIndex:i]), '\0'};
NSString *str=[NSString stringWithCString:currentLetter encoding:NSASCIIStringEncoding];
NSMutableArray *words = nil;
NSLog(@"Value of i:- %d:: Letter:- %@",i,str);
if (i<[letters length]) {
words = [self getUserInfoByStartingCharOfLastName:str isForEmptyValue:NO];
}
else {
// Get users where name is empty
words …Run Code Online (Sandbox Code Playgroud) 我从服务器获得推送通知.服务器始终在有效负载中发送badge = 1.
服务器端开发人员对此一无所知.任何人都可以告诉我服务器端开发人员如何处理徽章计数值,以便iOS应用程序获得更新的徽章计数(自动递增徽章计数)?
我可以在iOS应用程序端自动增加它吗?如果是这样,怎么样?
如果不是那么服务器开发人员如何处理服务器上的徽章计数?我看到几个链接告诉我服务器端应该处理徽章计数.
任何样本或参考都会有所帮助.
我想使用AVFoundation切换相机.这是我的代码我有NSObject的子类
@interface CaptureSessionManager : NSObject
@property (retain) AVCaptureVideoPreviewLayer *previewLayer;
@property (retain) AVCaptureSession *captureSession;
@property (retain) AVCaptureStillImageOutput *stillImageOutput;
@property (nonatomic, retain) UIImage *stillImage;
Run Code Online (Sandbox Code Playgroud)
在 @implementation CaptureSessionManager
- (id)init {
if ((self = [super init])) {
[self setCaptureSession:[[AVCaptureSession alloc] init]];
}
return self;
}
- (void)addVideoPreviewLayer {
[self setPreviewLayer:[[[AVCaptureVideoPreviewLayer alloc] initWithSession:[self captureSession]] autorelease]];
[[self previewLayer] setVideoGravity:AVLayerVideoGravityResizeAspectFill];
}
- (void)addVideoInputFrontCamera:(BOOL)front {
NSArray *devices = [AVCaptureDevice devices];
AVCaptureDevice *frontCamera;
AVCaptureDevice *backCamera;
for (AVCaptureDevice *device in devices) {
NSLog(@"Device name: %@", [device localizedName]);
if ([device …Run Code Online (Sandbox Code Playgroud) 我有这个方法=>
-(id)initWithLocationName:(NSString *)locatNm latitude:(double)lati longitude:(double)longi xCoord:(double)xco yCoord:(double)yco;
Run Code Online (Sandbox Code Playgroud)
在这种方法中,我需要为xCoord和yCoord分配nil值.如何将nil指定为double?
我使用JDateChooser从这里
但是setDateFormatString,在控制台中显示时,我无法使用该方法设置的格式检索日期.

在第一个标签中显示从中检索的实际日期,JDateChooser而第二个标签显示我已设置的格式.当我从中选择日期时,JDateChooser我会得到22-07-2011图像中显示的日期.但是当我使用getDate方法时,它会给我约会日期Fri Jul 22 00:00:00 GMT+05:30 2011.我只想要22-07-2011.
这是我的代码.我正在使用Netbeans IDE 7.0
public JDateChooser() {
initComponents();
dateChooser.setDateFormatString("dd-MM-yyyy");
}
private void btnDisplayDateActionPerformed(java.awt.event.ActionEvent evt) {
String dateFromDateChooser = dateChooser.getDate().toString();
lblDate.setText(dateFromDateChooser);
lblDateFormat.setText(dateChooser.getDateFormatString().toString());
System.out.println(dateFromDateChooser);
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new JDateChooser().setVisible(true);
}
});
}
Run Code Online (Sandbox Code Playgroud) 我在iOS 7.0.1和iPod Touch第5代设备上运行我的应用程序.当我按照以下步骤操作时,我的应用程序在Xcode 5上退出以下错误而控制台没有任何错误
App quit Unexpectedly Terminated due to Memory Pressure
Run Code Online (Sandbox Code Playgroud)
步骤:1)使用Xcode运行我的应用程序5.登录然后转到主页
2)单击主页按钮,以便我的应用程序进入后台(我可以看到我的应用程序在后台)
3)从iOS启动内置照片应用程序.单击1或2张图片
4)拍摄1-2张照片后,应用程序因内存压力而意外终止
我在我的应用程序中没有做任何事情.当我检查CPU使用率时,其使用的0%和Memeory = 15.2 MB此外,除了我的应用程序之外,没有其他应用程序在后台运行.
任何人都可以帮忙吗?谢谢
我不明白为什么会这样.如果我不使用Photos.app,那么应用程序可以顺利运行.
当我在iPhone模拟器中运行此代码时,我无法从DB中删除记录.如果我在SQLite DB Browser中运行此查询,则效果很好.这是我的代码
SQLiteDB *sqliteConnect=[[SQLiteDB alloc] init];
sqlite3 *database;
if(sqlite3_open([sqliteConnect.databasePath UTF8String], &database)==SQLITE_OK)
{
sqlite3_stmt *compiledstatement;
const char *sqlstmt="delete from searchHistory where id = (select min(id) from searchHistory) ";
if(sqlite3_prepare_v2(database, sqlstmt, -1, &compiledstatement, NULL)==SQLITE_OK)
{
sqlite3_step(compiledstatement);
if(SQLITE_DONE != sqlite3_step(compiledstatement))
NSAssert1(0,@"Error while creating delete statement => %s",sqlite3_errmsg(database) );
}
NSLog(@"delete DONE");
sqlite3_finalize(compiledstatement);
}
sqlite3_close(database);
Run Code Online (Sandbox Code Playgroud)
当我使用调试器运行时,我得到以下错误=>
2011-04-08 08:42:34.049 MyApp[1838:20b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error while creating delete statement => not an error'
Run Code Online (Sandbox Code Playgroud)
SQLiteDB是我的类,它包含init和checkAndCopyDB方法的逻辑.我的数据库被复制到文档目录中.其他DB操作工作正常.请帮我.谢谢
我正在开发像eBay这样的iOS应用程序.对于此Web服务开发人员正在使用Magento.他为Login开发了Web服务.以下是情况:
1)如果我发送有效的登录凭证,他将返回我登录的使用信息作为响应+一个标志,结果为true,在这种情况下,http状态代码为200.
2)如果我发错密码,他会给我一个标志,因为结果=假,http状态代码是200.
基本上我不想依赖结果标志,因为如果开发人员更改了结果标志名称,那么iOS应用程序无法识别.所以我想遵循http状态代码的标准.
我的问题是,在第二种情况下,发送200作为http状态代码是正确的吗?我想他应该送我401?如果我错了,请纠正我.如果我是对的,有没有办法从php代码发送http状态代码,以便我可以检查iOS端的http状态代码?
ios6 ×2
ios7 ×2
iphone ×2
objective-c ×2
php ×2
avfoundation ×1
badge ×1
camera ×1
crash ×1
datepicker ×1
delete-row ×1
indexed ×1
ios ×1
ios5 ×1
java ×1
jcalendar ×1
list ×1
magento ×1
netbeans ×1
sqlite ×1
swing ×1
uitableview ×1
web-services ×1
xcode5 ×1