小编Shw*_*car的帖子

有没有办法从主机应用程序获取应用程序组标识符并在iOS上共享扩展?

我已为我的主机应用和共享扩展设置了应用组.标识符看起来像"group.com.abc.xyzApp".有没有办法以编程方式获取此字符串?此外,如何检测是否以编程方式设置应用程序组?是否尝试使用应用程序组标识符初始化文件容器或用户默认值足以知道?例如:

[[NSUserDefaults alloc] initWithSuiteName:@"group.com.abc.xyzApp"].

objective-c ios share-extension

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

从iOS 7更新到iOS 8后故事板文件中的几处更改

我有几个情节提要文件。每次我只触摸文件时,我都会发现更改,但这是正常现象。但是,最近,我将Xcode更新为具有iOS 8.1支持的Xcode 6.1。我没有对情节提要文件进行任何更改。但是我看到了很多变化,主要是

  • 删除simulatedOrientationMetrics
  • 去除自动调整大小的面具
  • UI元素大小的更改,有时还会更改框架
  • 重命名组件

例如:

<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> 已被删除。

<deployment identifier="iOS"/> 已添加。

<simulatedOrientationMetrics key="simulatedOrientationMetrics" orientation="landscapeRight"/> 已被删除。

<rect key="frame" x="0.0" y="0.0" width="320" height="852"/>已修改为<rect key="frame" x="0.0" y="0.0" width="308" height="1024"/>

<!--Example Table View Controller - Example--> 已修改为 <!--Example-->

还有其他人看到类似的变化吗?如果是这样,为什么要更改它们?

xcode objective-c ios

5
推荐指数
0
解决办法
648
查看次数

将NSDate转换为本地时区,检查"今天"或"明天"并在NSString中获取日期

我之前已经问过类似的问题,但我的情况略有不同,我一直在努力寻找解决方案.

我有我的代码这样做:

NSDate *messageDate = [NSDate dateWithTimeIntervalSince1970:time / 1000];

NSTimeZone *currentTimeZone = [NSTimeZone localTimeZone];

NSTimeZone *utcTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"];

NSInteger currentGMTOffset = [currentTimeZone secondsFromGMTForDate:messageDate];

NSInteger gmtOffset = [utcTimeZone secondsFromGMTForDate:messageDate];

NSTimeInterval gmtInterval = currentGMTOffset - gmtOffset;

// get final date in LocalTimeZone
NSDate *destinationDate = [[NSDate alloc] initWithTimeInterval:gmtInterval sinceDate:messageDate];

static NSDateFormatter *formatter;
static dispatch_once_t sOnce = 0;
dispatch_once(&sOnce, ^{
    formatter = [[NSDateFormatter alloc] init];
});

[formatter setDateFormat:format];
[formatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]];
[formatter setTimeZone:[NSTimeZone localTimeZone]];

NSString *absTime = [formatter stringFromDate:destinationDate];
Run Code Online (Sandbox Code Playgroud)

现在我有一个问题.例如:

time …
Run Code Online (Sandbox Code Playgroud)

objective-c ios

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

标签 统计

ios ×3

objective-c ×3

share-extension ×1

xcode ×1