小编4ma*_*oud的帖子

如何将我当前的位置分享给UIActivityViewController?

我知道我可以将文本,URL,图像等内容添加到UIActivityViewController中,但是如何使用我的位置缩略图添加我当前的位置,如下面显示的推文?换句话说,如何在UIActivityViewController中共享坐标"纬度,经度"?

谢谢

一个有位置的推文

ios uiactivityviewcontroller

9
推荐指数
3
解决办法
7409
查看次数

警告:"最小字体大小大于当前字体大小"

在我的应用程序中,我使用具有一组标签的自定义单元格,我看到xcode在自定义单元格xib文件中显示有关字体大小的警告:

警告消息文件://localhost/Users/mahmoudalgayed/Desktop/Ajurry-date/CustomCell.xib:警告:不支持的配置:最小字体大小大于当前字体大小

任何人都知道如何摆脱这种警告?提前致谢

xcode objective-c interface-builder uilabel ios

7
推荐指数
2
解决办法
4161
查看次数

BGTaskScheduler.shared.register 未调用

我正在使用后台刷新来安排本地通知并更新我的小部件。问题是没有调用任务注册方法!

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
    BGTaskScheduler.shared.register(forTaskWithIdentifier: "com.Mahmoud.AdaniLite.AppRefresh", using: nil) { task in
        print("Registered")
        self.handleAppRefresh(task: task as! BGAppRefreshTask)
    }
  return true
} 
Run Code Online (Sandbox Code Playgroud)

我在带有打印语句的寄存器方法内也有一个断点,但两者都不起作用!

我已经完成了研究,到目前为止我已经尝试了以下方法:

  1. 我确保 info.plist 中的“允许的后台任务调度程序标识符”填充了正确的任务标识符。我已经三次检查该字符串是否在代码中也正确使用。
  2. 启用“后台获取”功能。
  3. 在 info.plist 中,我将“应用程序在后台处理数据”添加到“所需的后台模式”中
  4. 我正在运行 iOS 15 的真实设备上运行该应用程序

非常感谢任何帮助或指导!

xcode swift background-fetch

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

如何加快UIScrollView中的滚动?

我想在UIScrollView中进行分页/滚动更快,所以当用户左手时,无论加速的速度如何,下一页都会比正常情况更快.

提前致谢

paging scroll objective-c uiscrollview ios

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

向主题发送消息 - Firebase iOS

我想从我的客户端应用程序向使用 Firebase 订阅特定主题的其他设备发送消息。Firebase 文档告诉我如何发送此请求以部署此消息:

主题 HTTP POST 请求发送到单个主题:

https://fcm.googleapis.com/fcm/send  
Content-Type:application/json  
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA

{  
  "to" : /topics/foo-bar",  
  "priority" : "high",  
  "notification" : {  
    "body" : "This is a Firebase Cloud Messaging Topic Message!",  
    "title" : "FCM Message",  
  }  
}
Run Code Online (Sandbox Code Playgroud)

我不知道如何在我的代码中实现这一点,我尝试过但没有成功,这是我的代码:

NSDictionary *dic1 = @{
                       @"body : "  : @"This is a Firebase Cloud Messaging Topic Message",
                       @"title : " : @"FCM Message"
                       };

NSDictionary *dic2 = @{
                      @"to : " : @"/topics/news",
                      @"priority : " : @"high",
                      @"notification : " : dic1 …
Run Code Online (Sandbox Code Playgroud)

objective-c ios firebase

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

如何更改UINavigationController背景颜色?

我可以UINavigationController通过覆盖drawRect:方法来改变背景图像:

@implementation UINavigationBar (UINavigationBarCategory)

- (void)drawRect:(CGRect)rect {

    UIImage *img  = [UIImage imageNamed: @"navController.png"];
    [img drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
        self.tintColor = [UIColor blueColor];
}

@end
Run Code Online (Sandbox Code Playgroud)

背景是我打算成为的tintColor,也是如此,但是当尝试设置UIColor类中不存在的颜色时,它会失败并显示奇怪的颜色:

@implementation UINavigationBar (UINavigationBarCategory)

- (void)drawRect:(CGRect)rect {

    UIImage *img  = [UIImage imageNamed: @"navController.png"];
    [img drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
        self.tintColor = [UIColor colorWithRed:(26/255) green:(103/255) blue:(159/255)                      alpha:1];
}

@end
Run Code Online (Sandbox Code Playgroud)

我怎么强迫UINavigationBar显示我想要的颜色?

注意:我只对导航控制器按钮颜色有问题,因为背景本身设置为图像.

iphone xcode objective-c uinavigationbar ios

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

为什么ViewPager很慢

我正在使用ViewPager在多个图像之间滑动,但是在图像之间滑动是缓慢而且不平滑,尽管我只加载了少量图像.这是我的完整代码

MainActivity.java

public class MainActivity extends ActionBarActivity implements ActionBar.TabListener {

public static SectionsPagerAdapter mSectionsPagerAdapter;
public static ViewPager mViewPager;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

mSectionsPagerAdapter = new   SectionsPagerAdapter(getSupportFragmentManager());

mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);

}

public class SectionsPagerAdapter extends FragmentPagerAdapter {


public SectionsPagerAdapter(FragmentManager fm) {
    super(fm);
}

@Override
public Fragment getItem(int position) {

    Fragment fragment = null;
    Bundle args = new Bundle();

    fragment = new Page();
    args.putString(Page.ARG_SECTION_NUMBER, position);
    fragment.setArguments(args);

    return fragment;

}

public int getItemPosition(Object object) {
    Log.v("MBG", "getItemPosition"); …
Run Code Online (Sandbox Code Playgroud)

java xml android

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

每天在不同时间点火本地通知

我正在开发一个项目,每天在与预定义数据库不同的时间通知用户,准确地说每天五次.

我的问题是如何安排所有这些时间,5times*365days = 1825火日期!! 是否有可能安排他们所有?

任何想法将非常感激

xcode objective-c ios uilocalnotification

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

我无法在网址中发送带阿拉伯字母的请求

我正在开发一款利用Google搜索API并搜索阿拉伯语内容的iPhone应用程序.

每当我发送包含URL中的阿拉伯字母的请求以获取JSON文件格式时,我收到错误消息表明请求失败.这是请求的样子:

https://www.googleapis.com/customsearch/v1?oe=utf-8&ie= ISO-8859-6&key=[MY KEY]&cx=013036536707430787589:_pqjad5hr1a&q=????&alt=json

这是我的代码中调用请求并检索数据的方法:

NSURLConnection *connection = [[NSURLConnection alloc]initWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://www.googleapis.com/customsearch/v1?oe=utf-8&ie= ISO-8859-6&key=[MY KEY]&cx=013036536707430787589:_pqjad5hr1a&q=????&alt=json"]] delegate:self];
Run Code Online (Sandbox Code Playgroud)

url json objective-c ios

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

最新版本的Xcode与Mountain Lion不兼容

我升级到Mac OS 10.8(Mountain Lion),我在从Mac App Store安装Xcode 4.3.1时遇到问题.它说:

"Xcode can’t be installed on “Macintosh HD” because the version of OS X is too new." 
Run Code Online (Sandbox Code Playgroud)

有什么想法吗?提前致谢.

我已经注册了iOS开发者程序而不是Mac程序,谢谢

编辑

我是一名iOS开发人员,我想下载用于在iPhone,iPod和iPad上开发应用程序的iOS SDK.不是Mac/Safari开发人员,我快速搜索并发现苹果没有发布xcode版本"为iOS开发"这与山狮相容"可以安装在山狮没有为山狮开发!",我必须等待一两个星期,谢谢

macos xcode ios

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