小编Vir*_*vaj的帖子

从iPhone应用程序启用/禁用Apple推送通知?

我还有一个疑问APNS.这是当应用程序首次启动应用程序请求Apple推送通知权限时,如果用户接受了他们可以接收通知.如果用户取消他们无法收到任何通知.我清楚吗?

现在我的怀疑是,

  1. 如果用户第一次如果Cancel他们想要接收Apple推送通知,则在几天后再次从应用程序(单击按钮)取消推送通知服务时,可以从应用程序再次为特定用户启用Apple推送通知.

  2. 如果用户接受苹果推送通知服务第一,过了些日子,如果他们不希望收到通知,可以禁用APNS在我们的应用程序?我希望你理解我的怀疑.任何人都可以澄清这个疑问吗?

  3. 可以在我们的iPhone应用程序中执行以上场景吗?

请帮我.提前致谢.

iphone permissions push-notification apple-push-notifications ios

20
推荐指数
3
解决办法
4万
查看次数

从UITableViewCell呈现UIAlertController

我正在尝试向自定义添加警报以UITableViewCell呈现UIAlertView我需要从中调用presentViewController UIViewController.但是,我不知道如何UIViewControllerUITableViewCell类中获取当前实例的访问权限.以下代码是我尝试使用扩展程序执行此操作.

我收到这个错误

表达式解析为未使用的函数

extension UIViewController
{

    class func alertReminden(timeInterval: Int)
    {
        var refreshAlert = UIAlertController(title: "Refresh", message: "All data will be lost.", preferredStyle: UIAlertControllerStyle.Alert)

        refreshAlert.addAction(UIAlertAction(title: "Ok", style: .Default, handler: { (action: UIAlertAction!) in
            Alarm.createReminder("Catch the Bus",
                timeInterval: NSDate(timeIntervalSinceNow: Double(timeInterval * 60)))
        }))

        refreshAlert.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: { (action: UIAlertAction!) in
            println("Handle Cancel Logic here")
        }))

        UIViewController.presentViewController(refreshAlert)


    }
}

class CustomRouteViewCell: UITableViewCell {
Run Code Online (Sandbox Code Playgroud)

uitableview uiviewcontroller ios swift

15
推荐指数
5
解决办法
2万
查看次数

当ios中的地区是"英国"时,如何获得系统时间格式?

我在ios中使用以下代码获取系统时间格式.当我目前的地区设置为"United State"时它工作正常,但是当我将该地区从"United State"改为"United Kingdom"时,它总是给出12小时的合成.

#pragma mark
#pragma mark - get system time
-(BOOL)getSystemTimeFormat
{
    NSString *strDateFormate = @"hh a";
    NSString *dateFormat = [NSDateFormatter dateFormatFromTemplate:strDateFormate options:0 locale:[NSLocale currentLocale]];
    if ([dateFormat rangeOfString:@"h"].location != NSNotFound)
    {
        [kNSUserDefaults setBool:YES forKey:@"TimeFormat"];
        [kNSUserDefaults synchronize];
        return YES;
    }
    else
    {
        [kNSUserDefaults setBool:NO forKey:@"TimeFormat"];
        [kNSUserDefaults synchronize];
        return NO;
    }

}
Run Code Online (Sandbox Code Playgroud)

"美国"地区的日志::

2015-01-27 11:32:16.090 [350:60b] 12 Formate :: 0
2015-01-27 11:32:16.585 [350:60b] Connect
2015-01-27 11:32:16.591 [350:60b ]位置更新...
2015-01-27 11:32:16.604 [350:60b]位置更新...
2015-01-27 11:32:16.622 [350:60b]位置更新...

"英国"地区的日志::

2015-01-27 11:33:35.785 [364:60b] 12 Formate …

iphone objective-c nsdateformatter date-formatting ios

14
推荐指数
1
解决办法
945
查看次数

将视频上传到Facebook

我正在尝试使用以下代码将视频上传到Facebook

public void uploadVideosFacebook(String videoPath)
{
    byte[] data = null;

    String dataMsg = "Your video description here.";
    String dataName="Mobile.wmv";
    Bundle param;

    AsyncFacebookRunner mAsyncRunner = new   AsyncFacebookRunner(API);
    InputStream is = null;
    try {
       is = new FileInputStream(videoPath);
       data = readBytes(is); 

       param = new Bundle();
       param.putString("message", dataMsg);
       param.putString("filename", dataName);
       param.putByteArray("video", data);
       mAsyncRunner.request("me/videos", param, "POST", new fbRequestListener(), null);



    } catch (FileNotFoundException e) {
       e.printStackTrace();
    } catch (IOException e) {
       e.printStackTrace();
    }
}



public byte[] readBytes(InputStream inputStream) throws IOException {
      // this dynamically extends …
Run Code Online (Sandbox Code Playgroud)

android facebook

5
推荐指数
1
解决办法
3283
查看次数

startAnimatingWithImagesInRange反向

我正在开发Apple手表应用程序.在应用程序中,我有动画进度条.我在用

  - (void)startAnimatingWithImagesInRange:(NSRange)imageRange
                                 duration:(NSTimeInterval)duration
                              repeatCount:(NSInteger)repeatCount 
Run Code Online (Sandbox Code Playgroud)

这对于增加0到50的进度很好.我想知道是否有任何方法可以将此反转为50到0.我已经尝试使用减去NSRange长度值而没有运气.

谢谢

animation reverse ios apple-watch

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

需要在iPhone中仅显示带有日期UIDatePicker的工作日

有没有什么办法,只显示一周的一天,日期为:MON 03-JULUIDatePicker以iPhone.

请帮忙.

iphone uidatepicker nsdateformatter ios

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

如何为listview标题添加保证金?

我想添加textviewlistview页眉和给左边距它.这是我做的:

//create a textview, not inflating from layout
TextView selectAdressText = new TextView(getContext());
selectAdressText.setTextSize(12);
selectAdressText.setTextColor(getResources().getColor(R.color.text_black));

LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.setMargins(10, 0, 10, 10);
selectAdressText.setLayoutParams(lp);   

addressesLV.addHeaderView(selectAdressText);
Run Code Online (Sandbox Code Playgroud)

但它给出了nullpointerexception.我也试过AbsListViewLayoutparams而不是LinearLayoutLayoutParams但它没有setMargins方法.那LayoutParams我应该用哪个呢?

谢谢

android listview nullpointerexception layoutparams

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

强制退出/向上滑动以杀死iOS应用程序而不点击横幅/警报时如何获取推送通知有效负载?

我正在构建一个应用程序来处理从Parse推送的通知,并尝试创建通知历史记录功能.我已经成功启用了后台模式,因此当应用程序在后台运行时,应用程序可以很好地获得有效负载,application:didReceiveRemoteNotification:fetchCompletionHandler甚至不会点击横幅/警报.但是,当强制退出/向上滑动以杀死应用程序时,application:didReceiveRemoteNotification:fetchCompletionHandler不会被调用.

在没有点击横幅/警报的情况下杀死应用程序时,是否有任何方法可以实现获取推送通知有效负载?先感谢您!

xcode push-notification apple-push-notifications ios

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

通过命令行在MySQL(Windows 8.1)上安装"Employees Sample Database"

我试图MySQL通过命令提示符安装'Employees示例数据库' .我已下载了employees_db-full-1.0.6.tar.bz2.我提取了相同内容并希望通过命令行安装它.我正在使用一Windows8.1台机器.

请帮助我使用正确的命令或任何其他方式(如果有的话).MySQL网站上的命令适用于Linux机器.它不适用于Windows.请帮忙.提前致谢.

mysql windows command-line install sample

0
推荐指数
1
解决办法
1702
查看次数